Android Code Snippet [B4Xpages]A natural method for alerting the user of the locked orientation of a B4XPages App

I have a B4XPages landscape only app.

When the user is holding the device in portrait mode, the app opens in landscape mode. This can be annoying.
I thought it would be nice to let the user know in portrait mode that the app is in landscape mode.
Then, when the user naturally rotates the device, the app would start automatically.

If the user is already in landscape mode, the app would just start.

The attached shows how that can be done. It remarkably compact.
The method also would work with portrait only apps, with the change of a few lines.
Instead of just a message, this would also be a good way to have a splash screen in the orientation that the user is holding the device.
 

Attachments

  • alertUser.zip
    15.2 KB · Views: 222
Last edited:

angel_

Well-Known Member
Licensed User
Longtime User
I find it very useful, from what I see is it only for B4A?
 

William Lancee

Well-Known Member
Licensed User
Longtime User
I don't have B4i, and it isn't relevant to B4J (we don't rotate our desktops very often - just to dust!).
I don't know how the iPhone and iPad handle rotations, or whether this technique is needed, but somebody out there does.
 
Top