clamp
clamp

Reputation: 34006

android device rotation

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!

Upvotes: 0

Views: 1294

Answers (1)

Mike Yockey
Mike Yockey

Reputation: 4593

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.

Upvotes: 2

Related Questions