Possible Duplicate:
How to set android show vertical orientation?
I'm trying to disable auto rotation when I run my application in Android. Maybe, I should add a line code in AndroidManifest.xml Anyone know How can I do that ?
Possible Duplicate:
How to set android show vertical orientation?
I'm trying to disable auto rotation when I run my application in Android. Maybe, I should add a line code in AndroidManifest.xml Anyone know How can I do that ?
Add something like android:screenOrientation="portrait"
or android:screenOrientation="landscape"
in the AndroidManifest.xml:
<activity android:name=".MyActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
add a
android:screenOrientation="<mode>"
attribute to your activity.
see modes here: http://developer.android.com/guide/topics/manifest/activity-element.html#screen
<activity android:name=".SomeActivity"
android:label="@string/app_name"
android:screenOrientation="portrait">
for portrait mode.
Add the android:screenOrientation
attribute to your <activity />
tag:
<activity android:screenOrientation="landscape"
... >
For further information and a list of possible values visit the documentation.
You can make your Activity stay in a single orientation mode by adding the code suggested in the other answers. A more complete way of dealing with this is here:
http://developer.android.com/guide/topics/resources/runtime-changes.html
When you change orientation what you're doing is changing the app configuration. Look under the heading of "Handling the configuration change yourself" section to override the default behaviour.