android - Enable and disable auto rotate programmatically? -
there lot of cool widgets out there enable , disable auto rotate on phone. disabling turns off across apps on phone.
any ideas how accomplishing it?
this should trick you:
import android.provider.settings; public static void setautoorientationenabled(context context, boolean enabled) { settings.system.putint( context.getcontentresolver(), settings.system.accelerometer_rotation, enabled ? 1 : 0); }
add permission androidmanifest.xml
<uses-permission android:name="android.permission.write_settings" />
you can find documentation here
Comments
Post a Comment