I\'m trying to temporarily lock the orientation of the Android device, where most of the time it changes with the sensor. So what I want to do is figure out what the current
I am not sure if the constant is the issue that was no implemented on that API. Have you tried something like this?
switch (((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay().getRotation()) {
case Surface.ROTATION_90:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
break;
case Surface.ROTATION_180:
setRequestedOrientation(9); /* ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT */
break;
case Surface.ROTATION_270:
setRequestedOrientation(8); /* ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE */
break;
default :
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
}