Bonjour,
En cliquant sur un Bouton, cela ouvre un FragmentActivity.
Depuis celui-ci j'aimerai afficher un Fragment.
voici les codes :
Le FragmentActivity :
1 2 3 4 5 6 7 8 9
| public class GoOnPlaylist extends FragmentActivity {
protected void onCreate(Bundle savedInstanceState)
{
super.onCreate(savedInstanceState);
setContentView(R.layout.goonplaylist);
}
} |
Son Layout :
1 2 3 4 5 6 7 8 9
| <?xml version="1.0" encoding="utf-8"?>
<fragment xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/goonplay"
android:name="egingenierie.mfm.PlaylistListFragment"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
class="egingenierie.mfm.PlaylistListFragment" >
</fragment> |
et le Fragment :
1 2 3 4 5 6 7 8 9 10
| public class PlaylistListFragment extends Fragment implements StreamUpdaterCallback {
....
...
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
view = inflater.inflate(R.layout.playlist_fragment, container, false);
...
} |
et son Layout :
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
| <?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:orientation="vertical" >
<ListView
android:id="@+id/listView"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:background="#FFFFFF"
>
</ListView>
</LinearLayout> |
Quand je clique cela ForceClose, puis voila le message d'erreur:
07-12 10:02:35.175: E/AndroidRuntime(14161): java.lang.RuntimeException: Unable to start activity ComponentInfo{egingenierie.mfm/egingenierie.mfm.GoOnPlaylist}: android.view.InflateException: Binary XML file line #2: Error inflating class fragment
Voila le problème, Merci pour votre aide !
Ps : On m'a déjà demandé de vérifier si le nom de class appelé dans le xml était juste, et il l'est.
Partager