views:

691

answers:

2

I been following the Tab example provided by Google. I am trying to use the XML layout provided to setup a tab layout.

I use this XML layout @ 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>

When ever I switch the Layout tab in the Eclipse layout designer I get a NullPointerException: null error inside my Eclipse.

This happens also when I try to drag and drop a TabHost, and then a TabWidget into an empty layout file.

What am I doing wrong ? this seems pretty simple.

+3  A: 

Found it has been recorded as an issue already

http://code.google.com/p/android/issues/detail?id=2021

Thanks anyway

Andrew Cetinick
+1  A: 

All the issues with the sample code are listed here.

cdonner