Set screen autorotation system setting from code

android

Solution

Check this link

http://developer.android.com/reference/android/provider/Settings.System.html#ACCELEROMETER_ROTATION

And here is the code for you

android.provider.Settings.System.putInt(getContentResolver(),
android.provider.Settings.System.ACCELEROMETER_ROTATION,1);

And this permission required in Manifest

`<uses-permission android:name="android.permission.WRITE_SETTINGS" />`

Problem

I'm trying to figure out how to modify this setting programmatically. Could someone indicate an API or suggest something? The images illustrate where this option is in Android:

Original source