My activity forces portrait mode using android:screenOrientation="portrait"
in the manifest. However, some of my users (on tablets that are by default in landscape mode) have asked me to make this a configurable option. Is it possible to set the orientation in code (without triggering an orientation-change animation, so before the activity is actually displayed)?
Asked
Active
Viewed 84 times
1

Nick
- 3,504
- 2
- 39
- 78
1 Answers
1
Yes, simply call:
Activity.setRequestedOrientation (int requestedOrientation)
Taken from
http://developer.android.com/reference/android/app/Activity.html#setRequestedOrientation%28int%29
If you want to lock the screen orientation after setting it, take a look at this post:

Community
- 1
- 1

Philipp Jahoda
- 50,880
- 24
- 180
- 187
-
Awesome, Phil, thanks for your answer, it works beautifully :)! – Nick Aug 12 '13 at 09:32