-1
  1. Is there a way to set programmatically the orientation to reverse portrait?
  2. Can I disable orientation change animation ?

2 Answers2

1
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);

Hope this helps

https://developer.android.com/reference/android/content/pm/ActivityInfo.html#SCREEN_ORIENTATION_LANDSCAPE

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