I want my android application to be only run in portrait mode?
In the manifest, set this for all your activities:
<activity android:name=".YourActivity" android:configChanges="orientation" android:screenOrientation="portrait"/>
Let me explain:
- With
android:configChanges="orientation"
you tell Android that you will be responsible of the changes of orientation. android:screenOrientation="portrait"
you set the default orientation mode.
In Android Manifest File, put attribute for your <activity>
that android:screenOrientation="portrait"
There are two ways,
- Add
android:screenOrientation="portrait"
for each Activity in Manifest File - Add
this.setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
in each java file.