Screen size change avoid

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

Screen size change avoid

Postby marcelloma » Fri Apr 03, 2009 3:50 pm

Is it possible to avoid entering the landscape mode when raising the screen?
Thanks
marcelloma
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Mar 18, 2009 4:31 pm

Top

Postby lostgame » Fri Apr 03, 2009 4:00 pm

I would definitely be interested in knowing this as well. The app I'm designing can only work in portrait.
lostgame
Junior Developer
Junior Developer
 
Posts: 18
Joined: Thu Apr 02, 2009 8:59 pm

Postby marcelloma » Fri Apr 03, 2009 7:52 pm

lostgame wrote:I would definitely be interested in knowing this as well. The app I'm designing can only work in portrait.


Actually I found the solution, in the AndroidManifest add to the activity tag
Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:screenOrientation="portrait"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


and one more useful thing, normally if you show the keyboard the constructor of the default(?) view, is called again so the game ends up reinitialising again, just add this:

Syntax: [ Download ] [ Hide ]
Using xml Syntax Highlighting
  1. android:configChanges="keyboardHidden|orientation"
Parsed in 0.000 seconds, using GeSHi 1.0.8.4


to tell android you want to handle this events on you own, then you'll have to override this method
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1.  
  2.     @Override
  3.  
  4.     public void onConfigurationChanged(Configuration newConfig) {
  5.  
  6.       //ignore orientation change
  7.  
  8.       super.onConfigurationChanged(newConfig);
  9.  
  10.     }
Parsed in 0.030 seconds, using GeSHi 1.0.8.4

to ignore any orientation change.
marcelloma
Junior Developer
Junior Developer
 
Posts: 12
Joined: Wed Mar 18, 2009 4:31 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 2 guests