lock/unlock orientation

Per http://developer.android.com/reference/android/R.attr.html#screenOrientation (screenOrientation being what those values are linked to if you dig through the documentation), SCREEN_ORIENTATION_SENSOR or SCREEN_ORIENTATION_FULL_SENSOR will do it, depending on how much flexibility you want -- however, I suspect what you really want is to go back to the default setting, which is SCREEN_ORIENTATION_UNSPECIFIED so that it goes back to the system defaults, including any the user set.


An easy fix for this that worked for me is to add a line to AndroidManifest.xml like so:

Add android:screenOrientation="portrait"> in the application section.

<application android:icon="@drawable/icon" android:label="@string/app_name">
    <activity android:name=".App"
              android:label="@string/app_name"
              android:screenOrientation="portrait">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>

</application>