Android Question Change orientation

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
Hi to Everybody here
till to day, I have developed some Apps, which are basically technical Apps requiring no "virtousity" on User interface. Therefore I simply forced Screen orientation to Portrait, i designed my Layouts with the VisualDesigner and I had no problems. Now I have the need to have runtime changes in orientation. I use B4x pages. There are some issues on which I need some help. There are some posts here, but, due to Android and B4a changes along the time, I am not sure on the best approach to solve my problems. Unluckily the App was not designed keeping in account of orientation changes. First of all, I see that, if I change orientation, the App restarts. My App has a first Layout, say "0", which manages some initial issues, then a second layout "1" is called and the most of work is done here. When I change orientation during the work on "1" layout, the App restarts with "0" page, and I lose everything. I need an hint on how to manage this crucial fact. Then, what is better to do to display a new layout "1" ? Make a variant or manage the control positions in another layout, loaded at orientation changes? Note that the change of orientation may happen at any time, not necessarily when the "1" layout is loaded. Btw the "0" layout has no problems of orientation and is rather simple. Thanks in advance for any hint.
 

DonManfred

Expert
Licensed User
Longtime User
-Are you using b4xpages?

B4XPages are limited to be on one Orientation.

You can have ADDITIONAL activities to use another orientation. But not in the B4XPages-Pages.

From the B4XPages-Tutiorial

2. It does have some limitations. One notable limitation is that in B4A, the activity that holds all the pages should be locked to a single orientation.
 
Upvote 0

GiovanniPolese

Well-Known Member
Licensed User
Longtime User
-Are you using b4xpages?

B4XPages are limited to be on one Orientation.

You can have ADDITIONAL activities to use another orientation. But not in the B4XPages-Pages.

From the B4XPages-Tutiorial
Unluckily yes, I am using B4XPages... To be sincere, I see that layout "0" changes orientation correctly, as long as Layout "1". I mean: if I start with an orientation, everything seems to work, besides being some controls not in the right position. In few words, it seems that I can work just starting with an orientation, avoiding to change it at runtime. WIth my App structure, I could detect initial orientation when layout "0" appears, and It should be enough to load a layout "1Vertical" or "1Horizontal", instead of the actual "1". Of course I must block the orientation changes event.
 
Upvote 0
Top