0

I created an app with 2 tabs using TabLayout...

I need to integrate that application with another application.But while i reach the tab page,its ending up with an error

java.lang.RuntimeException: Unable to start activity ComponentInfo{com.android/com.android.simphone.SimFoneDetailsActivity}: java.lang.RuntimeException: Your content must have a TabHost whose id attribute is 'android.R.id.tabhost'

I changed the id of the TabHost,but no use......Please any suggestions are welcome...

The xml portion of the code is also attached...

<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" 
android:background="@drawable/bg_sim">
<LinearLayout 
android:id="@+id/LinearLayout01" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:orientation="vertical">
<TabWidget 
android:id="@+id/tabs" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"></TabWidget>
<FrameLayout 
android:id="@+id/tabcontent" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"></FrameLayout>
</LinearLayout>
</TabHost>
subrussn90
  • 1,142
  • 1
  • 14
  • 27

2 Answers2

1

What's your layout xml code? Do you write like this:

<TabHost
        android:id="@android:id/tabhost"
        android:layout_width="fill_parent"
        android:layout_height="fill_parent" >
......
</>
Jake
  • 131
  • 2
  • 5
  • 13
1

try this

<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" 
android:background="@drawable/bg_sim">
<LinearLayout 
android:id="@+id/LinearLayout01" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"
android:orientation="vertical">
<TabWidget 
android:id="@android:id/tabs" 
android:layout_width="fill_parent" 
android:layout_height="wrap_content"></TabWidget>
<FrameLayout 
android:id="@android:id/tabcontent" 
android:layout_width="fill_parent" 
android:layout_height="fill_parent"></FrameLayout>
</LinearLayout>
</TabHost>

Note that for tabs to work correctly you need to use this @android:id/

Shubhayu
  • 13,402
  • 5
  • 33
  • 30