03-17-2011 05:40 AM
when torch's slide is close, its orientation can be landscape.then, when you start application, it s started also with landscape mode. but, I want to start application always with portrait mode. how can I do this ?
I try to use
int directions = net.rim.device.api.system.Display.DIRECTION_NORTH | net.rim.device.api.system.Display.DIRECTION_PORTRA
IT ; net.rim.device.api.ui.Ui.getUiEngineInstance().set AcceptableDirections(directions);
but, it doesnt work, if device mode is landscape when application start.
also, it starts with landscape mode and when you turn to portrait mode, application continues with portrait mode and will not again go to landscape mode. so, only problem occurs when application starts. how can I start application always in a portrait mode ?
05-26-2011 02:20 PM - edited 05-26-2011 02:44 PM
I have the same problem. It is fine with starting on landscape mode but not on portrait mode.
I use following code for landscape mode.
int directions = net.rim.device.api.system.Display.DIRECTION_WEST | net.rim.device.api.system.Display.DIRECTION_EAST;
So I thought the code for portrait mode should be like below
int directions = net.rim.device.api.system.Display.DIRECTION_SOUTH | net.rim.device.api.system.Display.DIRECTION_NORTH;
However DIRECTION_SOUTH does not even exist and with DIRECTION_NORTH alone, the code is not working perfectly
05-26-2011 02:43 PM - edited 05-26-2011 02:44 PM
You cannot "force" a specific orientation. The app will come up in whatever orientation the phone is in, when first started. All you can do is lock the screen into the desired mode, once the phone is put in this orientation.
In other words, if you set only "Portrait" as acceptable, but start the app with the phone in landscape orientation, the app will start in landscape. Once the phone orientation is changed, and the app repaints in the portrait mode, it will stay there.
05-26-2011 02:51 PM
But the opposite case works.
In other words, if you set only "landscape" programmatically, but start the app with the phone in portrait orientation, the app will start in landscape. So even if the phone orientation is changed, the app does not need to repaint to the landscape mode because it is already landscpe mode. It will stay on landscape as is.