mscwd01 wrote:
> Hi,
> 
> I have had several complaints from people with G1 and MyTouch/G2
> devices who say my application does not work correctly. The problem
> stems from the following code which gets the orientation of the phone:
> 
> 
> // Get Screen Orientation
> Display display = ((WindowManager) getSystemService
> (WINDOW_SERVICE)).getDefaultDisplay();
> int screenOrientation = display.getOrientation();
> 
> I manually rotate the interface if the phone is in portrait
> (screenOrientation = 0) or landscape (screenOrientation = 1).
> 
> On my HTC Hero the code works fine and the correct orientation is
> determined, however on G1 and MyTouch devices it apparently never
> returns the correct orientation. As I do not have either of those
> phones to test this problem I am guessing they may return the opposite
> values to the HTC Hero?
> 
> Can anyone possibly explain this problem or let me know how to
> determine the screen orientation on ALL devices?

You can try getConfiguration().orientation, which will be one of a
series of constants on the Configuration class.

-- 
Mark Murphy (a Commons Guy)
http://commonsware.com | http://twitter.com/commonsguy

_Beginning Android_ from Apress Now Available!

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to