10

I currently have a Tab Screen in my Android application, it hosts 4 other activities from its Tabs.

I set up each tab as follows:

intent = new Intent().setClass(this, LiveActivity.class);
spec = tabHost.newTabSpec("live_tab").setIndicator(getString(R.string.tab_contacts),
res.getDrawable(R.drawable.ic_tab_contacts)).setContent(intent);
tabHost.addTab(spec);

All works fine, however when I change the orientation on the device I take care of the orientation change separately within each individual activity, each activity also has a different landscape layout in XML.

When I change the orientation on the device the change works OK for the activity I'm currently on but if I change the orientation back (so its portrait to landscape to portrait) then my activities seem to reload and get reset to their initial state rather than honoring my onRetainNonConfigurationInstance() method.

Has anyone come across this before and perhaps come across a solution?

Donal Rafferty
  • 19,707
  • 39
  • 114
  • 191
  • Did you handle the bundleinstance object which is coming to the method onCreate ? – Pavandroid Mar 21 '12 at 14:14
  • In the TabScreen? No at the minute I'm not using that at all, is that what I should be looking into? – Donal Rafferty Mar 21 '12 at 14:15
  • Can you try once by using bundleinstance as this is the one which takes care about the state of the activity at the time of configChanges.Just save this bundleinstance in destroy method and set the same object for the new activity. – Pavandroid Mar 21 '12 at 15:03
  • What do I save to the bundle instance in onDestroy though that will keep my activities states? – Donal Rafferty Mar 21 '12 at 16:05

0 Answers0