Is there a way to programmatically lock an app in portrait mode for certain operations, and then resume (and have the app rotate to landscape if the user is holding the device that way) after the operation is complete?
Android Settings Start by going to Settings => Display and locate the “Device rotation” setting. On my personal cell phone, tapping this will reveal two options: “Rotate the contents of the screen,” and “Stay in portrait view.”
setRequestedOrientation(ActivityInfo. SCREEN_ORIENTATION_LANDSCAPE); Called on an activity, will lock it to landscape.
Try this:
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT); //Do your operation setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_SENSOR);
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