I'm working on an Android open source application. This application contains many activities.
I want to deactivate the rotation in all activities. How to do that in Java and not in XML?
I'm working on an Android open source application. This application contains many activities.
I want to deactivate the rotation in all activities. How to do that in Java and not in XML?
In XML:
<activity android:name=".SomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
In Java:
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Sadly, you have to do it for every activity or create an abstract PortraitActivity, which will be extended by all your application's activities.