java - Get current orientation and lock -
I am trying to get the current orientation of an activity and lock it like this, but it opened Whenever opened in landscape mode
// getRequestedOrientation (); SetRequestedOrientation (activity info SCREEN_ORIENTATION_LOCKED); thanks
You have the screen orientation locked, it showed In your portrait in portrait mode, you should use the screen orientation sensor.
setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_SENSOR); Edit.
int str = 0; {Str = settings}. SystemGateIN (contexto.getContentResolver (), Settings.System.AccLROMETRation); } Hold (SettingNotFoundException e) {e.printStackTrace (); } If (str! = 0) {setRequestedOrientation (ActivityInfo.SCREEN_ORIENTATION_SENSOR); } Also check the link, I think it can help you.
Comments
Post a Comment