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

Posts: 18
Registered: ‎05-17-2012
My Device: NA
My Carrier: NA

On Getting Incorrect Screen_Width and Screen_Height When Orientation Changes During a Pop Up Screen or Loading Screen

[ Edited ]

I had an issue with Orientation change in Blackberry when there is a PopUp or Loading Screen ...


I know that On Orientation change of screen sublayout of the Screen gets called and the Screen width and Screen height gets changed accordingly  (This is as per what the behaviour should be )


So .... When i tilt the device for the first time the Orientation gets changed as per LANDSCAPE or PORTRAIT 

but the Display.getWidth() and Display.getHeight() does not take the exact value of the Screen's Width and Screen's Height for the first time when there is a Pop Up Screen or Loading Screen (It remains the same as before eg: If i have a 480x800 9860 device in Portrait mode .... it remains 480x800 in first tilt of device from Portrait to Landscape or vice versa  ) .... But it works perfectly fine when i tilt the device in another Orientation for the second time and hence forth ..... 


What could be the issue with the first tilt of Blackberry device when there is a Pop Up Screen or Loading Screen


Below is the code used in screen and Alert screen:



void sublayout(int width, intheight) {


if (Display.getOrientation() != screen_orientation) {


if (getVirtualKeyboard() != null

&& getVirtualKeyboard().getVisibility() == VirtualKeyboard.





screen_orientation = Display.getOrientation();


if(getFieldCount() != 0) {










super.sublayout(width, height);




UIConstants .init() is initializing all constant values used in application. 

ImgConstants.init() is initializing all imges according to screen width and height.

init() is initializing constants used in class.

buildGUI() is building GUI of screen.


Thanks in Advance.