I have tried to freeze orientation using:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Although the display stays in
Try this:
1.- Set the desired screen orientation in your AndroidManifest.xml
android:screenOrientation="portrait|landscape"
It should look like this:
2.- Add this to your onCreate void(or wherever you want) in your java Activity File(Example: "MainActivity.java"):
super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);
It should look like this:
protected void onCreate(Bundle savedInstanceState) {
super.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LOCKED);}
Now the screen wont move even if the Screen Rotation is on in the Device.