Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Java Development

Reply
New Developer
adem666
Posts: 103
Registered: ‎05-05-2009
My Device: Not Specified

start application with portrait mode

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_PORTRAIT
			;
	
net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(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 ?

Please use plain text.
Developer
AlbertSiu
Posts: 58
Registered: ‎09-22-2010
My Device: Not Specified

Re: start application with portrait mode

May be you need to repaint your screen after setting the screen orientation.

Please use plain text.
SKC
New Contributor
SKC
Posts: 7
Registered: ‎11-12-2010
My Device: 8900

Re: start application with portrait mode

[ Edited ]

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;
        net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(directions);

 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;
        net.rim.device.api.ui.Ui.getUiEngineInstance().setAcceptableDirections(directions);



However DIRECTION_SOUTH does not even exist and with DIRECTION_NORTH alone, the code is not working perfectly



 

Please use plain text.
Developer
RexDoug
Posts: 4,764
Registered: ‎07-21-2008
My Device: Not Specified

Re: start application with portrait mode

[ Edited ]

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.

 

 

Please use plain text.
SKC
New Contributor
SKC
Posts: 7
Registered: ‎11-12-2010
My Device: 8900

Re: start application with portrait mode

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.

Please use plain text.