I have a tab host contain four tabs,in my first tab i have two button , when i click first button i need to go to the second tab in tab host, similarly when i cl开发者_如何学运维ick the third button i need to go to third tab .
If anyone know the solution please help me out.
The TabHost has a method called 'setCurrentTab(int index)' which you can call inside your button's onclick handler. http://developer.android.com/reference/android/widget/TabHost.html#setCurrentTab(int)
Karthi,
This can be done with the setCurrentTab()
method from TabHost
. You may want to follow this tutorial: http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
Use:
tabHost.setCurrentTab(index);
精彩评论