开发者

How to navigate between Tabs in android

I have created a TabActivity in my android application. When user selects the second tab, an alert dialog will app开发者_Go百科ear. Is there any way to navigate to the previous tab when user clicks the cancel button for the dialog box.

regards dj


I found the solution here:

Android - Switch Tabs from within an Activity within a tab

In my case, I have used the solution of 'GrandPrix'.


I think you need to first know about the Tab Widget:

  1. http://developer.android.com/resources/tutorials/views/hello-tabwidget.html
  2. http://www.androidpeople.com/android-tabhost-tutorial-part-1/

You can set the tab using setCurrentTab method:

   tab_host.setCurrentTab(2);   // 2nd tab button is showing initially

same way, you can set the tab-button on the cancel button.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜