android default landscape mode code example

Example 1: android disable landscape mode

<activity android:name=".SomeActivity"
    android:label="@string/app_name"
    android:screenOrientation="portrait" />

Example 2: how to set landscape in android studio

in the manifest, set as attribute of the node activity the code below:
android:screenOrientation="landscape"

Also, in you MainActivity Class, inside the onCreate method, after the super call type:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);

Tags:

C Example