Android Question B4XPages device orientation

JakeBullet70

Well-Known Member
Licensed User
Longtime User
If I want to support both landscape and portrait orientations do I have to release 2 different apps?
 

JakeBullet70

Well-Known Member
Licensed User
Longtime User
Here is what I have done.

B4X:
#SupportedOrientations: unspecified

Then in the designer, created a new variant for portrait mode (my original is in landscape)

This seems to work as whenever the app is started in it selects the correct view (portrait / landscape)
I added a global

B4X:
guiHelpers.gIsLandScape = Not (lv.Height > lv.Width)

Designer code also supports the 'Portrait' var for IF statements
There are some tweaks I need to make here and there but it seems to be OK

(See below)
So, while you cannot switch when running it seems you can support both portrait and landscape in a single app.
If I run into anything else, I will post.
 
Last edited:
Upvote 0

JakeBullet70

Well-Known Member
Licensed User
Longtime User
An update to this: B4XPages is supporting both landscape and portrait without restarting the app.
I am looking at it right now. The B4xMainPage does get recreated on rotation.

I do have code in the Starter class so wondering if that is having some affect.
 
Upvote 0

Ivica Golubovic

Active Member
Licensed User
Upvote 0
Top