how to disable landscape mode in android code example
Example 1: android disable landscape mode
<activity android:name=".SomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait" />
Example 2: disable portrait mode android
// add this in your manifest.xml
<activity
android:name=".MainActivity"
<...other code>
android:configChanges="orientation" //<--ADD THIS
android:screenOrientation="portrait"> //<--ADD THIS