Question

how can i get the rotation of the device in the four main orientations? and is there a corresponding event that i can capture?

also, is it possible to disable this rotation for my app?

thanks!

Was it helpful?

Solution

Explains how to get the size and orientation of the screen. http://indyvision.net/2010/02/android-screen-size-orientation/

However, the device already changes its own behavior depending on the device orientation. For instance you can specify screen layouts dependent on the orientation, one for vertical and one for horizontal.

To prevent the Activity from rotating with the device, you can add android:screenOrientation="portrait" or "landscape" to AndroidManifest.xml for each Activity declared in your app.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top