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
Contributor
demaniak
Posts: 34
Registered: ‎07-05-2011
My Device: Various
Accepted Solution

How can I reliably determine the full pixel width and height of the screen?

Hi all.

The JavaDoc for Display.getHeight() and Display.getWidth () states that:

Retrieves the total drawing height of the display.

Retrieves the total drawing width of the display. 

 repectively.

 

What this implies is that if on (for example a 9860) the soft keyboard is open, the value returned by getHeight() will be different from the value returned when the keyboard is NOT open.

 

SO how can I reliably get the real full pixel widht/height of a screen?

Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: How can I reliably determine the full pixel width and height of the screen?

You coulld just get it once at startup time - before your app has opened a screen with an input Field.  Share that round. 

Contributor
demaniak
Posts: 34
Registered: ‎07-05-2011
My Device: Various

Re: How can I reliably determine the full pixel width and height of the screen?

That is indeed what I went with - couldn't see any other way.

Bordering on "global variables", which we all know is evil :Devil2:

 

But oh well.

Whatever works, right?

 

Thanks for the help peter!

Developer
peter_strange
Posts: 19,609
Registered: ‎07-14-2008
My Device: Not Specified

Re: How can I reliably determine the full pixel width and height of the screen?

More like static variables than global variables.

 

The trick is if you allow rotation.  In that circumstance, then you can actually detect rotation because of the change in the width.  You can't, as you have found out, use a change in height.