TabActivity onSaveInstanceState

Put problem concerning Views, Layouts and other XML-Resources (like AndroidManifest) here.

TabActivity onSaveInstanceState

Postby paulspiteri » Mon Jan 26, 2009 3:28 pm

Hi there
I'm really stuck with this simple problem....what do I put in the override of onSaveInstanceState of my TabActivity derived class?
When I change the orientation of the display, all the open tabs are lost. How do I preserve them?

Thanks very much
paulspiteri
Freshman
Freshman
 
Posts: 8
Joined: Mon Jan 26, 2009 3:15 pm

Top

Postby paulspiteri » Mon Jan 26, 2009 5:09 pm

Please, can anyone help to save the state of this TabHost?
None of the examples do so...which kinda makes me wonder if it's required.
You would expect the super implementation of TabActivity to handle this automatically....

Anyone got anything to say? :)
paulspiteri
Freshman
Freshman
 
Posts: 8
Joined: Mon Jan 26, 2009 3:15 pm

Postby rdomloge » Wed Jan 28, 2009 12:33 am

I have been having similar problems. As I understand it, TabHost was released as deprecated code, but was un-deprecated in v1.0. I get the impression it is buggy code which will need to be revised. The example code out there is basic to say the least and many of the apps in the Market are choosing to use their own tabbing implementations.

Are you using Intents for the contents of your tabs?

Can you post some code?

I have been using Intents and that seems to work reasonably well, except for orientation like you say. I suspect that their is either a bug in the implementation or the design is flawed.

I don't have a problem with the tab contents not being remembered though - rotation causes onCreate() to be called again and I set up the tabs in this method.

My issue is that, re-creating each tab upon rotation causes the managed dialog mechanism to fail. The dialogs that are being managed are forgotten when the tab is replaced.

I have recently been advised not to use Intents to create the tabs, so I will be experimenting with alternatives in the near future.

Post up some code samples and I'll take a butchers.
rdomloge
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sat Jan 24, 2009 2:11 pm

Postby paulspiteri » Wed Jan 28, 2009 12:39 am

Hi
I am using intents to create each tab, since I posted this thread I have changed my code so it will recreate the tabs in the TabActivity's onCreate(). It's not ideal but if that's how it need be....

Now my only real complaint with the tab control is that I cant seem to close a tab?! :?
paulspiteri
Freshman
Freshman
 
Posts: 8
Joined: Mon Jan 26, 2009 3:15 pm

Postby rdomloge » Wed Jan 28, 2009 12:43 am

You may want to keep an eye on this thread.
rdomloge
Junior Developer
Junior Developer
 
Posts: 24
Joined: Sat Jan 24, 2009 2:11 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 3 guests