Android Question Detect Screen Rotation with Portrait Orientation

Scantech

Well-Known Member
Licensed User
Longtime User
Can we some how determine the screen is rotated when Screen Orientation is set as Portrait only or Landscape only. I have B4X Panels in Portrait/Landscape view and i need to detect the screen orientation as it is rotated to Portrait/Landscape mode, so then i can call pnl.Rotation to rotate the panels.

This is useful to rotate many gauges very fast, instead of rotating and loading gauges.
 

emexes

Expert
Licensed User
I suspect there might be a problem with continuous rotation 0,1,2...88,89,90,91,92...178,179,180 compared to discrete 90 degree steps, in that the top-to-bottom (or left-to-right) sequence of gauges will reverse. Eg, with steering wheel in neutral position with phone at top of wheel, gauge order left-to-right on screen is ABCD, but when turn steering wheel half-turn so that phone is now at bottom of wheel, gauge order would then be DCBA.

But at least they'd have always been right way up and readable.

;-)
 
Last edited:
Upvote 0
Top