Locking the phone in portrait mode? (orientation)

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

Locking the phone in portrait mode? (orientation)

Postby isaackearl » Thu Jan 08, 2009 6:08 pm

yes I have two views a custom draw view I've made and a view for preferences. When the keyboard is slid open and the orientation the whole program resets, as I'm sure you all know. What I want is a way to lock the orientation to portrait so if they open the keyboard in the drawview it Stays exactly how it is and continues to function in portrait mode. Is there any way I can lock the orientation? thanks

Isaac
isaackearl
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Nov 25, 2008 8:09 pm

Top

Postby falstaff » Fri Jan 09, 2009 12:47 pm

Hello,

This might work in onCreate:
Syntax: [ Download ] [ Hide ]
Using java Syntax Highlighting
  1. setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_NOSENSOR);
  2.  
Parsed in 0.030 seconds, using GeSHi 1.0.8.4


If not, look at this constants, maybe another (e.g. SCREEN_ORIENTATION_USER) works...
http://code.google.com/intl/de-CH/android/reference/android/content/pm/ActivityInfo.html

bye
falstaff
falstaff
Freshman
Freshman
 
Posts: 3
Joined: Fri Jan 09, 2009 12:30 pm

Postby MrSnowflake » Fri Jan 09, 2009 4:45 pm

You can/should(in this case maybe) enforce your orientation in the manifest.
User avatar
MrSnowflake
Moderator
Moderator
 
Posts: 1439
Joined: Sat Feb 16, 2008 3:11 pm
Location: Flanders, Belgium

Postby isaackearl » Fri Jan 09, 2009 7:35 pm

MrSnowflake wrote:You can/should(in this case maybe) enforce your orientation in the manifest.


AH thanks, got it!
isaackearl
Junior Developer
Junior Developer
 
Posts: 20
Joined: Tue Nov 25, 2008 8:09 pm

Top

Return to View, Layout & Resource Problems

Who is online

Users browsing this forum: No registered users and 5 guests