Android Question Phone.SetScreenOrientation inconsistent?

doncx

Active Member
Licensed User
Longtime User
My app needs to freeze the current orientation, whatever that may be, and then release it for further rotation later using phone.SetScreenOrientation(-1).

Using the reflection library, I consistently get rotation values of 0,1,2,3 across devices (current target devices are Nexus 10 and Nexus 9 tablets) where 0 is landscape and the following numbers are clockwise 90 degree rotations.

However, when I use the current rotation value to SET the screen orientation, it works differently on the two devices.

The following works on the Nexus 10:

Select GetOrientation
Case 0
SetOrientation = 0 'landscape
Case 1
SetOrientation = 9 'Reverse Portrait
Case 2
SetOrientation = 8 'Reverse Landscape
Case 3
SetOrientation = 1 'Portrait

But this is what's needed on the Nexus 9:
Select GetOrientation
Case 0
SetOrientation = 1 'Portrait
Case 1
SetOrientation = 0 'Landscape
Case 2
SetOrientation = 9 'Reverse Portrait
Case 3
SetOrientation = 8 'Reverse Landscape

How can I find a mapping of Get to Set that works across devices?
 

doncx

Active Member
Licensed User
Longtime User
Upvote 0
Top