Landscape To Portrait

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

Landscape To Portrait

Postby Karthikayan » Mon Mar 23, 2009 10:32 am

Hi All,

Im working on a game. I have a problem of retaining the game status when the view is changed from portrait to landscape of vice verse. If I'm in between a game and i do change view, the game restarts. I want to resume the game from the point where it paused. How can i handle this.

Thanks
Karthikayan
Freshman
Freshman
 
Posts: 6
Joined: Thu Oct 23, 2008 4:57 pm

Top

Postby wiederke » Mon Mar 23, 2009 1:11 pm

Hi,

I suggest reading the following article.

http://android-developers.blogspot.com/ ... hange.html


Cheers

Torsten
wiederke
Experienced Developer
Experienced Developer
 
Posts: 72
Joined: Mon Mar 02, 2009 6:46 pm
Location: Germany

Postby Emmanuel7 » Tue Mar 24, 2009 2:33 am

You need to save your game state when it is destroyed.

For that, use the onSaveInstanceState method to save the state.
To restore the game, use the Bundle parameter that is given in the onCreate method of your activity.
Emmanuel7
Senior Developer
Senior Developer
 
Posts: 164
Joined: Fri Dec 12, 2008 2:17 am
Location: Paris

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 4 guests