I am wondering how to switch off the orientation sensor completely in my android app for certain activities.
Here is what I struggle with. Let's say I set the orientation in the onCreate (or onStart/onResume) method of an activity dynamically with the following command.
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
What I experience is that screen is appearing on the display noticeable faster if I hold the device in a manner that would result in landscape mode according to the orientation sensor.
So what it feels like is as if the activity first wants to set the layout in the orientation as the sensor would suggest and thereafter it switches according to the setRequestedOrientation method. I even sometimes see this on the screen as described in a related post android - unexpected brief orientation change at switch of activity.
Seems like I am too late with the setRequestedOrientation call. So I am wondering how to switch off the the orientation sensor completely to avoid a setting of the orientation prior to the setRequestedOrientation call. Or as alternative, how to call setRequestedOrientation in time. As I need this feature dynamically as decided during runtime (preference settings) I cant set the orientation fixed in the manifest.
Thanks a lot in advance for any hint around this issue.
martin
Edit: I forgot to mention, the manifest contains
android:configChanges="keyboardHidden|orientation|screenSize"