In my Android Application, I am using TabbedGroupActivity, where it is maintaing 5 tab Activities, when the app is in background for a while 30 mins or so. The tab selection automatically changing to default tab. but the Activity View is not changing. for ex: my default tab-1 and I selected tab-4, and I kept the app in background by pressing home button, if I open it again after some time, the selected tab is Tab-1, but the activity showing is tab-4 activity. Please suggest a solution.
Asked
Active
Viewed 69 times
1 Answers
0
Keep a local variable in main activity from where all tab activities are maintained and set the selected tab with the help of that local variable. When the activity goes in background and is opened again check that local variable and set the selected tab based on it instead of default tab. Hope that helps.

Swati Sachdeva
- 253
- 2
- 11
-
Good thought, but the issue here is that MainActvity itself is destroying, when I see the Logs, It is calling start and creating the defatult TabgroupActivity and then creating previous selected tabgroup Activity, while keeping old view as it is, in next time opening – candy May 09 '13 at 06:37
-
1you can save the variable when onSaveInstanceState is called and while it is recreated you can fetch from saveinstance state which is passed as variable in onCreate. – Swati Sachdeva May 09 '13 at 06:43