You should have started a new thread with your new question, but there is already quite a lot in the forum about rotation sensing . Telling which way the device has been rotated should be quite straightforward using the Phone library and the orientation sensor, but I have no experience of this.
Some other things that I have thought of, although you may have already thought of them too ...
- If you use Layouts then you might be able to avoid a lot of calculations. You could detect the screen orientation in Activity_Create() and load the appropriate layout ..
isLandscape = (100%x > 100%y)
- If you cast your panel to a B4XView then you can use the view.rotate method. I have not tried this so I do not know what happens to child views.
- There are other #supportedOrientations options available, such as "sensorPortrait" - see elsewhere in the forum.