I am trying to create a tab view with will switch to a different content view by Id. Here is my tab activity
:
public class TabViews extends TabA
you need add tabwidget in the xml.... Checkout, this is how to use tab widget :
tabscroll.xml
public class Tabs5 extends TabActivity implements TabHost.TabContentFactory {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.tabs_scroll);
final TabHost tabHost = getTabHost();
for (int i=1; i <= 30; i++) {
String name = "Tab " + i;
tabHost.addTab(tabHost.newTabSpec(name)
.setIndicator(name)
.setContent(this));
}
}
/** {@inheritDoc} */
public View createTabContent(String tag) {
final TextView tv = new TextView(this);
tv.setText("Content for tab with tag " + tag);
return tv;
}
}
Courtesy : http://developer.android.com/resources/samples/ApiDemos/res/layout/tabs_scroll.html AND http://developer.android.com/resources/samples/ApiDemos/src/com/example/android/apis/view/Tabs5.html