views:

49

answers:

3

In my TabActivity the user may be asked to switch to browser activity for OAuth phase, and if the phase takes too much time, my activity will be killed. After the user switches back to my activity, its onCreate() method is invoked again and tabs are recreated.

So I would like to know if there is any simple way to switch back to previous tab, and keep the tab as what it was. For example, one of the tab views contains a ViewSwitcher child, and I want to switch back to the switched view after recreating the activity.

+1  A: 

Step #1: In onSaveInstanceState(), save the state of your tabs, flippers, etc., so you know where you were

Step #2: In onRestoreInstanceState(), call appropriate methods to restore your state (e.g., setCurrentTab()).

CommonsWare
A: 

Hi,

There are 3 tabs in ABC.jsp, I click on Second Tab, give values to taxt fields then press Submit button, action will go Model Class and process with Database, Again Coming back to Same ABC.jsp, by default First Tab will be Opened, but I want Second Tab has to be Selected.

Thanks

A: 

You can use intent in TabHost to set content of that tab.

tabHost .setContent(new Intent(this, XYZ.class)));

Rakesh Gondaliya