savestate

Put your problem here if it does not fit any of the other categories.

savestate

Postby linkmaster_6 » Tue Nov 04, 2008 7:41 pm

how would i go about saveing my programs state when the screen orientation is changed from landscape to protract?
linkmaster_6
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Thu Oct 16, 2008 8:52 pm

Top

Postby MrSnowflake » Tue Nov 04, 2008 8:36 pm

You have to keep track of stuff going on at the moment. In onCreateInstanceState() (or what was it) you save all data from the views (text, position, ...) and put it in the bundle. In OnRestore..State() you put everything back.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby linkmaster_6 » Tue Nov 04, 2008 9:09 pm

so in "public void onCreate(Bundle savedInstanceState)" savedInstanceState is where all my data if being stored right? if this is so how would i call it to restore my app? could you please give me some sample code? that would help me understand alot mroe. thank you very much
linkmaster_6
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Thu Oct 16, 2008 8:52 pm

Postby MrSnowflake » Tue Nov 04, 2008 10:24 pm

For orientation changes you should put everything back from the onRestore...State(). CHeck the doc for more info. There's a lot in it about it.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby linkmaster_6 » Tue Nov 04, 2008 11:15 pm

ok will do. thank you very much :)
linkmaster_6
Experienced Developer
Experienced Developer
 
Posts: 51
Joined: Thu Oct 16, 2008 8:52 pm

Top

Return to Other Coding-Problems

Who is online

Users browsing this forum: No registered users and 15 guests