J'ai quelques problèmes avec le fragment, je suis une erreur qui dit:fragment Fragment erreur de classe de gonflage
Binary XML file line #2 Error: inflating class fragment.
Cause by: Java.lan.NullPointerException: name == null
Ceci est mon fichier binaire:
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical" >
<fragment
android:id="@+id/fragment_content"
android:name="com.livetrekker.fragments.WelcomeFragment"
android:layout_width="0dp"
android:layout_height="0dp"
android:layout_weight="1" />
</LinearLayout>
Alors mon FragmentActivity:
public class SetupWizard extends FragmentActivity{
public void onCreate(Bundle bundle){
super.onCreate(bundle);
setContentView(R.layout.activity_wizardsetup);
FragmentManager fragmentManager = getSupportFragmentManager();
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
WelcomeFragment wf = new WelcomeFragment();
fragmentTransaction.add(R.id.fragment_content, wf);
fragmentTransaction.commit();
}
}
Et enfin mon fragment:
Public class WelcomeFragment extends Fragment {
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState){
return inflater.inflate(R.layout.welcomelivetrekker,container, false);
}
}
J'ai importé Android.support.v4.app.Fragment à la fois de mon fichier et vérifier sur Internet, mais aucune de la solution ne fonctionne.
cela fonctionne merci. Juste une petite erreur c'est
Kalimero95