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
Posts: 6
Registered: ‎05-06-2009
My Device: Not Specified

Problem with Display.getHeight()

[ Edited ]

Hello

 

I am writing an application which needs to get the height of the screen on the storm and other blackberry models, so I am using the Display.getHeight() method.

http://www.blackberry.com/developers/docs/4.7.0api/net/rim/device/api/system/Display.html

 

I am however experiencing a problem with using this method on the storm in landscape mode. The problem happens when the current screen holds the virtual keyboard, and I then click the back button to go to the provious screen. After doing this, it returns to the previous screen (one that does not have the keyboard up), but it doesn't get drawn properly, as Display.getHeight() only returns the paintable space left as if they keyboard was still there (it isn't) - something around 130 instead of the full 360.I have tried to explicitly tell the keyboard to hide before and after going back and I still get the same value from Display.getHeight(). I have not experienced any problems in portrait mode, which leads me to believe this may be a problem with the API.

 

Is there another method that can be used instead, or is this a defect with RIM's api?

 

edit: Forgot to mention: when I go through the menu on the page on question, and show the keyboard, it shows up fine. After hiding it, however, the page does not redraw. I need to move my finger on the screen a little bit or press on something for the screen to draw correctly (this also fixes the problem sometimes on the problem described above).

Message Edited by M@rc on 05-06-2009 02:00 PM
Developer
Posts: 696
Registered: ‎12-02-2008
My Device: Not Specified

Re: Problem with Display.getHeight()

Hi,

 

Call invalidate() on the screen which is not painting properly.

 

Please let me know if it solved your prob;em or not.

Regards,
Rajat Gupta.
--------------------------------------------------------------------------------
If your problem was get solved then please mark the thread as "Accepted solution" and kudos - your wish
New Developer
Posts: 6
Registered: ‎05-06-2009
My Device: Not Specified

Re: Problem with Display.getHeight()

Unfortunately, I have tried that after telling the screen to hide, and it did not solve the problem. Any other ideas?

 

Thanks

Developer
Posts: 86
Registered: ‎07-21-2009
My Device: Not Specified

Re: Problem with Display.getHeight()

I have had exactly the same problem - in two places. 

 

Basically, Display.height is changed while the virtual keyboard is displayed - and then not restored after the keyboard goes away, for the screen active under the keyboard. It seems you need to pop the screen that had the keyboard. Ugly.