Possible Duplicate: How to disable orientation change in Android?
I'm trying to produce an Android application. How can I prevent the application to rotate to the right and to the left even when the user rotates their device?
Possible Duplicate: How to disable orientation change in Android?
I'm trying to produce an Android application. How can I prevent the application to rotate to the right and to the left even when the user rotates their device?
By setting the orientation you want in the manifest...
Example: Add android:screenOrientation="portrait"
to the element in the manifest or landscape:
<application android:icon="@drawable/icon"
android:label="@string/app_name">
<activity android:name="QRCodeActivity"
android:label="@string/app_name"
android:screenOrientation="landscape" >
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
Also check Stack Overflow question Prevent screen rotation on Android.