If you are using Internet Explorer, please remove blackberry.com from your compatibility view settings.

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
Trusted Contributor
ankitagrawal
Posts: 141
Registered: ‎02-15-2012
My Device: 9800
My Carrier: Airtel

Issue in restricting App in PORTRAIT mode

Hi,

     I am getting issue when trying to launch application at first, it is starting in LANDSCAPE mode, event it is restricted for PORTRAIT mode.

 

While searching, When I gone through link, I observed that the problem has resolved from 5.0 according to M Sohn's statement(#8). But still getting this problem for 5.0, 6.0 and 7.1.

 

Can anyone please tell me, whether this problem has solved or not??

Please tell me, if issue still has to resolve.

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

Re: Issue in restricting App in PORTRAIT mode

In my experience, this is the normal behavior of the device. If the device is oriented in landscape mode when the app is started, it starts in landscape. Once the device is re-oriented to Portrait, it stays there (if so restricted).

 

Please use plain text.
Trusted Contributor
ankitagrawal
Posts: 141
Registered: ‎02-15-2012
My Device: 9800
My Carrier: Airtel

Re: Issue in restricting App in PORTRAIT mode

The behavior I am getting in my App is- When running the app in LANDSCAPE mode, it runs in PORTRAIT mode but the UI is affecting as per LANDSCAPE mode and when tilting back in PORTRAIT, it is not affecting.

But when launching application in PORTRAIT mode, then it runs fine.

 

Have you got my problem??

 

I am attaching file in it, this will helpful to make you understand.

In this image, Bottom bar is showing as per LANDSCAPE mode at the first time of Launch.


9550.jpg

Please use plain text.
Developer
Developer
CMY
Posts: 1,122
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Issue in restricting App in PORTRAIT mode

Are you trying to restrict it to LANDSCAPE or PORTRAIT? Since one of the OS5 revisions, the app will always open in the direction it is restricted to regardless of the direction of the phone. What is it that you are trying to accomplish?
Please use plain text.
Trusted Contributor
ankitagrawal
Posts: 141
Registered: ‎02-15-2012
My Device: 9800
My Carrier: Airtel

Re: Issue in restricting App in PORTRAIT mode

I have restricted App to launch in PORTRAIT mode.

As per image in my previous comment, when I was trying to open it in LANDSCAPE mode then it is fine that opens in PORTRAIT mode but by using Display.getWidth() and DIsplay.getHeight(), it is taking 480 and 360 respectively. But for PORTRAIT, it should take 360 and 480 respectively.

 

So tell me the better solution for this problem of Display.getWidth() and Display.getHeight().

Please use plain text.
Developer
Developer
CMY
Posts: 1,122
Registered: ‎02-10-2009
My Device: 8130 / 8350 / 9530 / 9550 / 9850 / PlayBook
My Carrier: Verizon

Re: Issue in restricting App in PORTRAIT mode

What are you trying to get the width and height for?

There are two ways you can go about it:
(1) You can use the width and height values passed into layout/sublayout as they should always be correct.
(2) You can check the acceptable directions allowed and then swap width/height as needed (ie if only portrait is allowed then you know the width will always be the smaller of the two values).
Please use plain text.
Developer
brijmohanyadav
Posts: 45
Registered: ‎08-29-2013
My Device: Blackberry curve-9360 and Blackberry bold-9860
My Carrier: Company

Re: Issue in restricting App in PORTRAIT mode

I have developed a blackberry app for BB-OS 6 and BB-OS 7. I have restrict my blackberry app in portrait. When i oriented device in landscape mode and open app the device hangs and nothing happend until i remove battery and restart device.

 

I have use following code to restrict app in portrait mode:

 

int directions = Display.DIRECTION_PORTRAIT | Display.ORIENTATION_PORTRAIT | Display.DIRECTION_NORTH;
        UiEngineInstance engineInstance = Ui.getUiEngineInstance();
        if (engineInstance != null)
        {
            engineInstance.setAcceptableDirections(directions);
        }

 

Please suggest me what is wrong in it.

 

Thanks in advance.
       

Please use plain text.