I have an application that can be viewed with landscape and portrait mode. I'm not using onConfigurationChanged() and android:configChanges="orientation|keyboardHidden" and the screen orientation change is working perfectly.
But now, i have a small problem. I want to learn to lock the screen orientation change of the screen. I mean that for example, when the user press a “lock” button, the screen orientation must be locked and it must not change, and when the user press again that button, the screen orientation must get unlocked
¿how can i lock the screen orientation dinamically?
For locking,
For unlocking,
where “activity” is your current Activity, in which you want to lock.