I need to lock my application in portrait mode on a Storm(and Strom 2) device.
I use Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_PORTRAIT);
for this.
Here is the problem:
The screen direction only changes once the device is rotated to a direction supported by the provided direction parameter.
(source)
If the user has the device in landscape mode and opens the application, the application will open in landscape and will only lock to portrait mode when/if the user rotates the device to portrait mode.
Is there any way to force the application in portrait mode even in the case I described above?
I have made a static method that I call from my application's
main()
method.See the full code in my answer to this question: How to fix alignment for vertical and portrait screen in BlackBerry?