I have tried to freeze orientation using:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
Although the display stays in portrait orientation, the activity is still recreated. Any ideas how to solve this?
How can the orientation of the application be locked such that the activity is not recreated on orientation change?
On the main screen of Rotation Manager, select an orientation by tapping on either the vertical or horizontal icons next to a specific app to lock it into either landscape or portrait mode. Highlighting both icons will allow that particular app to auto-rotate.
Simply turn your Apple® iPhone® to change the view. Access the Contol Center by swiping downward from the upper-right corner of the Home or Lock screen. For the iPhone with Touch ID, access the Control Center by touching the bottom of any screen then dragging upward. to lock or unlock screen portrait orientation.
Setting the app upWhen on the main screen, under the orientation section, you will see a number of options like 'Auto-rotate OFF', 'Auto-rotate ON', 'Forced Portrait' and 'Forced Landscape'. As the names suggest, you can use these buttons as one-tap shortcuts to toggle the orientation of your device.
First, don't use setRequestedOrientation()
if you can avoid it. Use the android:screenOrientation
attribute in your <activity>
manifest element instead.
Second, you will also need android:configChanges="keyboardHidden|orientation"
in your <activity>
manifest element to prevent the destroy/recreate cycle.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With