- Is there a way to set programmatically the orientation to reverse portrait?
- Can I disable orientation change animation ?
Asked
Active
Viewed 136 times
-1

Manos Rasidakis
- 3
- 1
- 16
-
[How to detect orientation change in layout in Android?](//stackoverflow.com/a/5726776) – Manohar Apr 20 '18 at 10:14
2 Answers
1
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Hope this helps
If you need more Reference then Change Screen Orientation programmatically using a Button

Venky
- 1,929
- 3
- 21
- 36
1
Yes by using
you can change it with:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
to detect orientation change implement an
OrientationEventListener mOrientationListener;
you can find more help here
Or a better approach can be simply force a screen orientation in your AndroidManifest.xml file like this for example:
<activity android:name=".DisableScreenRotationAndroid" android:screenOrientation="landscape">

Novy
- 1,436
- 1
- 14
- 26