rainer
rainer

Reputation: 3411

Codenameone rotate display

I am building an application that has 4 buttons on the start screen. Each button opens a new Interaction Dialog.

I want 3 of those dialogs to alway be in portrait mode, and 1 to open, and continue, in landscape mode.

The code of the orientation shall override the user's device configuration.

How would I go about achieving this? It seems trivial, but I couldn't find anything in the documentation or on the net.

What I have tried is

Display.getInstance().lockOrientation(true);

but the command does not lock the orientation of the display, at least not in the simulator.

Upvotes: 2

Views: 411

Answers (1)

Shai Almog
Shai Almog

Reputation: 52770

The simulator ignores the lockOrientation call. Furthermore, its effect is somewhat limited on iOS so it won't work as expected there because of some design decisions that are really hard to change.

In iOS the orientation is usually forced for the entire app using a build hint. You can configure that in Codename One Setting under the iOS section.

This method works more consistently when it's applied globally as it was in the Uber app.

Upvotes: 2

Related Questions