1

I have created a TabActivity in my android application. When user selects the second tab, an alert dialog will appear. 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'.

Community
  • 1
  • 1
Dijo David
  • 6,175
  • 11
  • 35
  • 46

1 Answers1

3

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.

Paresh Mayani
  • 127,700
  • 71
  • 241
  • 295