Before lollipop i use
android:configChanges="locale|keyboardHidden|orientation|screenSize"
public void changeFullScreenState(GoFullScreen event){
if(event.isToFullScreen()){
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE);
} else{
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR_PORTRAIT);
}
}
to change screen orientation. It worked for api>=15 && api <20. However this does not work on lollipop 5.02 Is there a way to fix it?
What device are you testing at? Some Emulators could give you wrong orientation.