Android Question [B4XPages] Set Page Orientation

MrKim

Well-Known Member
Licensed User
Longtime User
B4A/i/J app. I have seen a number of posts with solutions but all seem to indicate problems. My need is slightly different as their is no need to change orientation once it is selected.
The program has a number of 'modes'. Each mode will be either portrait or landscape. The mode is selected by the user, saved in settings and generally will never change. What the user runs will ALWAYS be either portrait or landscape.
Their will be no need to change orientation after the app determines which mode to run. All pages used will be either portrait or landscape. It needs to be locked in that orientation.
I would prefer to load a separate layout in the same page depending on orientation but if necessary I can create a separate page for each one.

Wondering what is the best way to impliment this?

Thanks for your help.
 

MrKim

Well-Known Member
Licensed User
Longtime User
You will need to lock the orientation before the call to pm.Initialize in the main activity.
I know this works in B4A
B4X:
    Dim MyPhone As Phone
    MyPhone.SetScreenOrientation(0 )
But the only things I found for B4i say it can't be done. Or that it is unreliable or undocumented.
Can you tell me the way to do this in B4i?
 
Upvote 0
Top