I'm new to android my question is, Is it possible to change orientation programmatically? If yes, how can we do that?
Asked
Active
Viewed 3,854 times
3 Answers
20
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Also add this in your manifest file (under activity):
android:configChanges = "orientation"

Bigflow
- 3,616
- 5
- 29
- 52
3
Yes, use setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); to force orientation

Alix Bloom
- 217
- 1
- 8
3
yes this one possible
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Android
- 1,417
- 9
- 11