0

I'm writing an Android app. How do I lock the orientation of the phone in the portrait mode?

George N
  • 151
  • 1
  • 1
  • 4
  • take a look at http://stackoverflow.com/questions/1512045/how-to-disable-orientation-change-in-android – Bobby Jul 09 '11 at 03:05

2 Answers2

1

In your AndroidManifest.xml add the following tag android:screenOrientation="portrait" in the Activity block. A sample would be:

    <activity android:name=".FusionDrone"
        android:label="@string/app_name"
        android:configChanges="orientation"
        android:screenOrientation="portrait"
        android:theme="@android:style/Theme.Translucent">
Matt Pope
  • 167
  • 2
  • 11
0

the android:screenOrientation="portrait" would be the way to go but if you want to do it programmatically, just call setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); in your onCreate()

JM Macariola
  • 103
  • 1
  • 4