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
safycool
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Problem in displaying UI in Landscape Mode....

I have created a UiApplication. My all screens extends NewMainScreen where

 

 NewMainScreen extends MainScreen

 

My new MainScreen constructor is

 

public NewMainScreen()
   { 
       super();
       super.add(manager);
      
   }

 

where manager is a instance of

NewVerticalFieldManager manager  = new NewVerticalFieldManager( Manager.VERTICAL_SCROLL | Manager.VERTICAL_SCROLLBAR | VerticalFieldManager.USE_ALL_WIDTH | VerticalFieldManager.USE_ALL_HEIGHT)

 

NewVerticalFieldManager extends VerticalFieldManager.. I have done this to render a Background image.

 

The application works fine on all the device but in case of Storm when you tilt the Device to lanscape mode...My application still remains in the portrait mode. How can I make my application run in both the mode depending on the orientation of the device i.e Portrait and Lanscape

 

Please use plain text.
Developer
mailsameer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: Problem in displaying UI in Landscape Mode....

See the "Display" class it will clear your doubts.... if you dont understand reply back
Sameer Joshi
Blackberry developer.
Please use plain text.
Developer
safycool
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Problem in displaying UI in Landscape Mode....

[ Edited ]

 

 

I know that method, but its only in 4.7 and I have made application for 4.2 and above.

 

There is no generalised way to achieve that functionality...

 

 

Thanks...

Message Edited by safycool on 08-06-2009 05:28 AM
Please use plain text.
Developer
mailsameer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: Problem in displaying UI in Landscape Mode....

yes there is..... use the preprocessors... in your application so that u can use the same code for version 4.2
Sameer Joshi
Blackberry developer.
Please use plain text.
Developer
safycool
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Problem in displaying UI in Landscape Mode....

Yup I am already using a pre processor.... But I want a single build i.e single cod to work on all devices....

 

Here I will have to make 2 builds i.e 4.2 - 4.6 and one build for 4.7 n above...

 

 

Thanks..

 

 

Please use plain text.
Developer
safycool
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Problem in displaying UI in Landscape Mode....

I have used phone listener to get the application on the foreground....

 

If i dont use the phone call to get the application to the foreground the application and if I click the application icon from Download folder the application  works perfectly in both portrait and landscape mode.

 

How can I make the application run in lanscape and portrait mode when i get the application to foreground using phone listener

 

Code to get the application to foreground is 

 

UiApplication.getUiApplication().requestForeground();
     
UiApplication.getUiApplication().pushScreen(new UIScreen());

 

 

 

Thanks...

Please use plain text.
Developer
mailsameer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: Problem in displaying UI in Landscape Mode....

ok , in that case, u need to do your layout programming in such a way that, it will depend on the Graphics.getScreenWidth() for all UI components. when you change the Orientation(landscape and portrait) of screen, layout of the fields gets called so there you can write some logic so that it will look good for both orientations.

 

By using preprocessors u cannot create 1 build so that is out of question.

Sameer Joshi
Blackberry developer.
Please use plain text.
Developer
safycool
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Problem in displaying UI in Landscape Mode....

[ Edited ]

This will be very complicated...The application is running perfectly in Portrait and Landscape mode if i click the icon of the application. But when i dial a number and get the application to foreground the application does not work in landscape and

portrait mode both, it is only working in Portrait mode even if you tilt the device. The PhoneListener in blackberry works outside the scope of the application.  Due to this the application doesnt seem get its orientation property. Is there any way by which I can  enable the Orientation property of the application and set it to the new UIScreen pushed to the foreground.

 

 

 

Thanks...

Message Edited by safycool on 08-06-2009 08:45 AM
Please use plain text.
Developer
safycool
Posts: 198
Registered: ‎04-03-2009
My Device: Not Specified

Re: Problem in displaying UI in Landscape Mode....

 

 Portrait and Landscape mode is working properly if the application is opened using SMS command.

 

 Problem is only when the application is opened using the PhoneListener. Any suggestion how to make the application work

 

 in both mode if the application is opened through phonelistener.

 

 

Thanks...

 

Please use plain text.
Developer
mailsameer
Posts: 132
Registered: ‎05-07-2009
My Device: Curve
My Carrier: Vodafone

Re: Problem in displaying UI in Landscape Mode....

Not sure though.....

 

try overriding activate() method,

 

See if it works?

 

As when we call setForeground() if application is already in foregraound it does nothing, and setForeground() actually calls the activate() method of Application class. try sending application to background and again bringing it to the foregraound.... 

 

I have not tried just a suggestion,

Sameer Joshi
Blackberry developer.
Please use plain text.