This isn't orientation, though, this is rotation. So your Tab in landscape
is Surface.ROTATION_0, while your phone in portrait is also going to
correspond to Surface.ROTATION_0. It's not the API that is lying to you.
On Sunday, August 21, 2011 1:25:12 AM UTC-4, Greg Donald wrote:
>
> Using API version 7, this code produces the exact opposite results on
> my Evo versus my Galaxy Tab:
>
> switch( getWindowManager().getDefaultDisplay().getOrientation() )
> {
> case 0:
> display_mode = MyApplication.HORIZONTAL;
> break;
>
> case 1:
> display_mode = MyApplication.VERTICAL;
> break;
>
> case 2:
> display_mode = MyApplication.HORIZONTAL;
> break;
>
> case 3:
> display_mode = MyApplication.VERTICAL;
> break;
> }
>
> log( "display_mode: " + ( display_mode == MyApplication.HORIZONTAL
> ? "HORIZONTAL" : "VERTICAL" ) );
>
>
> I switched to API version 13 to see if the problem was fixed in the
> future, and it also tells lies from one device to another.
>
>
> I have dynamic full screen graphics that cannot be skewed. I'm having
> to write code to compensate for the Galaxy Tab's 48 pixel bar at the
> bottom. getWindowManager().getDefaultDisplay().getHeight() says it's
> 800 but it's really only 752 due to the bar. Now I find I cannot even
> count on the display orientation being accurate to code up a fix for
> the initial problem.
>
>
> So how do I contend with this mess?
>
> What other devices can I count on to lie about their display and
> orientation?
>
> --
> Greg Donald
>
>
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en