Android Question Changing orientation causes B4Xpages go back to first page.

MarcRB

Active Member
Licensed User
Longtime User
I think it is normal behaviour, that at the moment the user rotates the phone, the first B4Xpage in pagestack will be shown.
But is it possible to change that behaviour?

At the first page there was a login
and at second page a dashboard.
The third page contains some fields and a editable table.
If the user decides to rotate the phone to portrait or landscape orientation, then the login page (1st) is shown again. Very annoying.

Thanks in advance
Marc
 
Solution
You can just do 1 app and detect what it started in and lock it in that mode.
I Copied this from somewhere here:

1667071401540.png

toby

Well-Known Member
Licensed User
Longtime User
Specify an orientation in Main
B4X:
    'SupportedOrientations possible values: unspecified, landscape or portrait.
    #SupportedOrientations: portrait
 
Upvote 0

agraham

Expert
Licensed User
Longtime User
B4XPages is supposed to be used only in a single orientation. It is a mistake to specify other than portrait or landscape orientation. Locking it to a single orientation saves dealing with activity lifecycle issues and as a bonus code can execute events while in the background.

 
Upvote 0

JakeBullet70

Well-Known Member
Licensed User
Longtime User
It is not going back to the first page it is restarting your app.
 
Upvote 0

MarcRB

Active Member
Licensed User
Longtime User
Thanks to all,

@ Toby: I know you can prefix the orientation, but it was just that feature to let the user decide for using in portait of landscape mode.

@ Serge: Indeed, I already use that RemovePreviousPages after login, but it's what Jake says, The app is restarting.

@ JakeBullet70 : I hadn't noticed that, Directly.

@ Agraham:
I understand it's meant to work that way.
Is it strange if I compile my app twice. Once as a landscape and once as a portait variant. In that case, the user still has the choice of which app (s)he wants to use.
 
Upvote 0

JakeBullet70

Well-Known Member
Licensed User
Longtime User
You can just do 1 app and detect what it started in and lock it in that mode.
I Copied this from somewhere here:

1667071401540.png
 
Upvote 0
Solution

MarcRB

Active Member
Licensed User
Longtime User
Jake and William,

This solved the problem. Thank you.

I will make a setting for that. The user have to set it in the app. At next (re)start that setting will fix the orientation.
In case there is no orientation setting stored, I can use the width < height trick.

Thanks for thinking :)
 
Upvote 0
Top