I want that my View rotates only in landscape mode, clockwise and counterclockwise.
I read about the only counterclockwise for android < 2.2 and that's not a problem, my App will be +2.2 for now.
I modify my manifest to catch Configuration Changes
android:configChanges="keyboardHidden|orientation"
I override my activity to catch Configuration Changes
@Override
public void onConfigurationChanged(Configuration newConfig) {
and I know how to catch orientation
Display display = ((WindowManager) getSystemService(WINDOW_SERVICE)).getDefaultDisplay();
int rot = display.getRotation();
but... I don't know how to trigger the appropiate landscape orientation, I am doing this:
if (rot == Surface.ROTATION_90 || rot == Surface.ROTATION_270){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
}
but always rotate to counterclocwise :-(
How can I set left and right landscape orientation?
EDIT
If I set orientation in manifest:
android:screenOrientation="landscape"
The activity's layout remains always in "left landscape", and I want change between left and right landscape :S