Why is eclipse highlighting R.id.tabhost?
android, android-tabhost, tabs
Solution
TabHost tabs=(TabHost)findViewById(android.R.id.tabhost);
or
TabHost tabs=getTabHost();
Problem
I'm trying to implement a tabs into my app, but id tabhost is being highlighted, why? Every tutorial I look at has TabHost tabs=(TabHost)findViewById(R.id.tabhost), and everytime I include this line id tabhost is hightlighted, with error: tabhost cannot be resolved or is not a field. recipe_list.java: ``` TabHost tabs=(TabHost)findViewById(R.id.tabhost); tabs.setup(); TabHost.TabSpec spec=tabs.newTabSpec("tag1"); spec.setContent(R.id.tab1); spec.setIndicator("Clock"); tabs.addTab(spec); spec=tabs.newTabSpec("tag2"); spec.setContent(R.id.tab2); spec.setIndicator("Button"); tabs.addTab(spec); ``` recipe_list.xml, I have list views in every tab: ``` <TabHost android:id="@android:id/tabhost" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical" > <TabWidget android:id="@android:id/tabs" android:layout_width="match_parent" android:layout_height="wrap_content" > </TabWidget> <FrameLayout android:id="@android:id/tabcontent" android:layout_width="match_parent" android:layout_height="match_parent" > <LinearLayout android:id="@+id/tab1" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listView1" android:layout_width="match_parent" android:layout_height="fill_parent" android:layout_weight="1" > </ListView> </LinearLayout> <LinearLayout android:id="@+id/tab2" android:layout_width="match_parent" android:layout_height="match_parent" > <ListView android:id="@+id/listView2" android:layout_width="match_parent" android:layout_height="wrap_content" android:layout_weight="1" > </ListView> </LinearLayout> <LinearLayout android:id="@+id/tab3" android:layout_width="match_parent" android:layout_height="match_parent" > </LinearLayout> </FrameLayout> </LinearLayout> </TabHost> ```