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
Posts: 114
Registered: ‎10-21-2010
My Device: Bold 9650
My Carrier: Develper
Accepted Solution

How to get physical size of Screen?

Hi all,

How to get physical width and height of Screen (not resolution) in inches or centimetres?

Is there any method to do it?

Many thanks !

 

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

Re: How to get physical size of Screen?

Display.getWidth() and Display.getHeight() will get you the actual number of pixels. 

Display.getHorizontalResolution(); and Display.getVerticalResolution() to get pixels per meter.  Then by dividing appropriately you can find out the actual size.

Trusted Contributor
Posts: 114
Registered: ‎10-21-2010
My Device: Bold 9650
My Carrier: Develper

Re: How to get physical size of Screen?

Thank you peter_stange !

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

Re: How to get physical size of Screen?

Display.getHeight() and Display.getWidth() is slightly misleading.

As per JavaDocs:

Retrieves the total drawing height of the display

 What this implies (I just discoved), is that if, for example, a soft keyboard is open, the values returned by those methods will be adjusted to reflect the space left for your app to do it's business.

 

So now my quesiton is, how can I reliably determine the full pixel width and height of the screen?

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

Re: How to get physical size of Screen?