3

I want to start my application in portrait mode, always, on a BlackBerry Storm, even then when device is in landscape mode.

How could I do that?

I know we can control the orientation after opening my app, by:

UiEngineInstance ui = Ui.getUiEngineInstance();
ui.setAcceptableDirections(Display.DIRECTION_NORTH); 

but how to open the app in portrait mode?

Cœur
  • 37,241
  • 25
  • 195
  • 267

1 Answers1

5

Use following just one line of code in constructor of each screen class.

Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_PORTRAIT);

I also get the problem with this in OS 7 phone, So I have fixed by issue with using below code:

Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_NORTH);

Vivek Kumar Srivastava
  • 2,158
  • 1
  • 16
  • 23
  • This is the correct way to do it (and only way that I'm aware of), but you should be aware that at least some users [have reported problems with it](http://supportforums.blackberry.com/t5/Java-Development/Issue-with-setAcceptableDirections-when-starting-in-a-different/td-p/196456) in some scenarios – Laepdjek Jun 29 '11 at 01:49