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
Developer
alfonsn
Posts: 34
Registered: ‎08-11-2011
My Device: BlackBerry Bold
Accepted Solution

Force Lock of Display Orientation

Hi, I'm currently using Ui.getUiEngineInstance().setAcceptableDirections(Display.DIRECTION_PORTRAIT) to lock the display on portrait mode. This works fine if I start my app while the BlackBerry is in portrait position (the display stays in portrait mode even when I change the device's orientation to landscape), but when I start my application in landscape position the fields on the display become a mess and I have to change the device's orientation to portrait before it become's locked in that position.

 

Is there a way to force/ set the display to portrait mode when the application is started in in landscape orientation?

Please use plain text.
BlackBerry Development Advisor
MSohm
Posts: 14,685
Registered: ‎07-09-2008
My Device: BlackBerry Z30, BlackBerry PlayBook

Re: Force Lock of Display Orientation

You are seeing the expected behaviour.  If the device is not in the desired orientation when the application starts you can prompt the user to rotate the device before displaying your application screen.

Mark Sohm
BlackBerry Development Advisor

Please refrain from posting new questions in solved threads.
Problem solved? Click the Accept As Solution button.
Found a bug? Report it using Issue Tracker
Please use plain text.
Developer
alfonsn
Posts: 34
Registered: ‎08-11-2011
My Device: BlackBerry Bold

Re: Force Lock of Display Orientation

Hi, thanks for the reply.

 

I tried using:

if (Display.getOrientation() == Display.ORIENTATION_LANDSCAPE)
{

UiApplication.getUiApplication().pushScreen(new ChangeOrientationView()); // Notify user to change orientation

}
else
{

startApp(); // Start application
}

 

But this only works for devices such as 9810 where the display width is smaller than the display height (default orientation of the display is portrait). It becomes a problem when I try to run this on devices such as the Bold 9000 where the default orientaion of the display is landscape.

 

If you're confused about what I'm trying to do, I want to lock the display in the state where the BlackBerry logo is on top.

 

Do you have any suggestions on how to do this?

Please use plain text.
Trusted Contributor
Albert_Anks
Posts: 151
Registered: ‎06-17-2010
My Device: Curve 8900

Re: Force Lock of Display Orientation

hi alfonsn,

 

Check out this link..

 

http://supportforums.blackberry.com/t5/Java-Development/Disable-screen-auto-rotation/m-p/1028509#M15...

 

------------------------------------------------------------------------------

please click 'Accept Solution' on posts that provide the solution to the question you've posted. Don't say "Thanks", press 'Like' button instead!

Please use plain text.