Android screen rotation  [FIXED]

Report bugs and issues

Android screen rotation

Postby blubee » 2013-04-14 21:47

I have a problem with my exported android project. In the Shiva Editor I designed the game in a landscape style. Then I didn't do any application.setrotation or anything like that just exported the stk and built a project. Then in the android manifest file I change the layout to landscape.

The app launches just fine and plays in landscape mode. If I quit the app and relaunch it it loads fine. The problem comes up when the application is backgrounded, either through pressing the home button or another app gaining focus. Now when the app launches again. It's in portrait mode, my landscape splash screen is stretched and the graphics are all rotated 90CCW

similar to this post by splashfoxgames
blubee
Junior Boarder
Junior Boarder
 
Posts: 38
Joined: 2013-03-08 21:40

Re: Android screen rotation

Postby dbladez » 2013-04-15 01:34

Most likely

oThis.setRequestedOrientation ( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) ;

is being called inside your [GameName].java file. In eclipse check the src / com.companyname.gamename folder and GameName.java file

maybe just add inside

protected void onResume ( )

or whatever function it is that gets called when a game resumes.

oThis.setRequestedOrientation ( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ) ;

And comment out the other sections where it gets set to portrait after a movie being played or whatever.

Hope that helps.
dbladez
Platinum Boarder
Platinum Boarder
 
Posts: 694
Joined: 2010-11-03 22:10
Location: Ontario, Canada

Re: Android screen rotation  [FIXED]

Postby gamescorpion » 2013-04-15 03:41

Solution as per Skype Conversation:
------
IN ECLIPSE Open your main Java File (src->YourApp.java)
1. Go down to line ~832 or (~1000) and look for ORIENTATION via the search. You are to comment out the line that says setRequestedOrientation:

//oThis.setRequestedOrientation ( ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE ) ;

There is another one on line ~862 (~1030) as well for Portrait mode. Comment that out as well:

//oThis.setRequestedOrientation ( ActivityInfo.SCREEN_ORIENTATION_PORTRAIT ) ;
// TODO: restore the original orientation
------


Nav
Game Scorpion Inc.
Armies of Riddle Collectible Card Game:
gamescorpion
Platinum Boarder
Platinum Boarder
 
Posts: 667
Joined: 2011-07-02 08:55
Location: Ontario, Canada

Re: Android screen rotation

Postby blubee » 2013-04-15 03:52

@gamescorpion & @dbladez thank you both, worked great!
blubee
Junior Boarder
Junior Boarder
 
Posts: 38
Joined: 2013-03-08 21:40

Re: Android screen rotation

Postby broozar » 2013-04-15 11:14

User avatar
broozar
Administrator
Administrator
 
Posts: 4172
Joined: 2007-09-16 10:22
Location: Berlin - Germany


Return to Bugs

Who is online

Users browsing this forum: No registered users and 1 guest

cron