Je suivais l'exemple de tabulation fourni par Google. J'essaie d'utiliser la disposition XML fournie pour configurer une disposition d'onglets.TabHost NullPointerException dans la présentation
J'utilise cette mise en page XML @http://developer.android.com/guide/tutorials/views/hello-tabwidget.html
<?xml version="1.0" encoding="utf-8"?>
<TabHost xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@android:id/tabhost"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<LinearLayout
android:orientation="vertical"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TabWidget
android:id="@android:id/tabs"
android:layout_width="fill_parent"
android:layout_height="wrap_content" />
<FrameLayout
android:id="@android:id/tabcontent"
android:layout_width="fill_parent"
android:layout_height="fill_parent">
<TextView
android:id="@+id/textview1"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a tab" />
<TextView
android:id="@+id/textview2"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is another tab" />
<TextView
android:id="@+id/textview3"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:text="this is a third tab" />
</FrameLayout>
</LinearLayout>
</TabHost>
Chaque fois que je passe l'onglet Mise en page dans le concepteur de mise en page Eclipse je reçois un NullPointerException: null erreur dans mon Eclipse. Cela se produit également lorsque j'essaie de glisser et déposer un TabHost, puis un TabWidget dans un fichier de disposition vide.
Qu'est-ce que je fais mal? Cela semble assez simple.
Tous les problèmes avec l'exemple de code sont listés [ici] (http://stackoverflow.com/questions/ 2209406/issues-with-android-tabhost-exemple). – cdonner