TabHost NullPointerException in layout

I followed the Tab example provided by Google. I am trying to use the XML layout provided to customize the tab layout.

I am using 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 I switch the Layout tab in the Eclipse layout designer, I get a NullPointerException: null error inside my Eclipse.

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

What am I doing wrong? it seems pretty simple.

+3
source share
1 answer

Found that it was registered as a problem already

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

+5

Source: https://habr.com/ru/post/1742825/


All Articles