Thursday, 31 December 2020

Android set orientation

I have an oddball android device which has no gravity sensors, and on that device, my "set orientaion" function does nothing. On all other devices, including some without sensors, the following works fine.

        Activity act = AndroidNativeUtil.getActivity();
    int newo = portrait 
        ?   (reverse
                ? ActivityInfo.SCREEN_ORIENTATION_REVERSE_PORTRAIT
                : ActivityInfo.SCREEN_ORIENTATION_PORTRAIT)
        :   (reverse
                ? ActivityInfo.SCREEN_ORIENTATION_REVERSE_LANDSCAPE
                : ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE);
    act.setRequestedOrientation(
            newo

is there some additional API that can lock the screen orientation? Some other apps successfully change the screen orientation.



from Android set orientation

No comments:

Post a Comment