添加设置读写权限:
判断是否屏幕旋转被关闭,如果关闭则打开:
// check whether the screen rotation works int flag = Settings.System.getInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 0); if (0 == flag) { // open screen rotation and give user infomation alert Toast.makeText(getApplicationContext(), "open screen rotation", Toast.LENGTH_LONG).show(); Settings.System.putInt(getContentResolver(), Settings.System.ACCELEROMETER_ROTATION, 1);