views:

245

answers:

1

Hi. I trying to determine display vertical size of my Blackberry Storm 2.

I know, my device has 480 pixels height. I try to get this value in my code, but if virtual keyboard is shown, i get value equals to 480 - (height of virtual keyboard). Is there any function to determine real display height on any device (with or without keyboard, with enabled or disabled virtual keyboard).

Im also discover RIM classes:

I get these values with hidden virtual keyboard:

Display.getWidth(); //360
Display.getHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getContentWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getContentHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getVirtualWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVirtualHeight(); //480
UiApplication.getUiApplication().getActiveScreen().getVisibleWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVisibleHeight(); //480

I get these values with showed virtual keyboard:

Display.getWidth(); //360
Display.getHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getContentWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getContentHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getVirtualWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVirtualHeight(); //248
UiApplication.getUiApplication().getActiveScreen().getVisibleWidth(); //360
UiApplication.getUiApplication().getActiveScreen().getVisibleHeight(); //248

Is there any way to determine real screen height?

+2  A: 

I would like to know workaround too

In the meantime you can store size of display for different devices and retrieve them depending on DeviceInfo.getDeviceName()

Or you can save Display.getHeight() value on app start

Max Gontar
+1 on reading and saving the Display.getHeight() on app startup (before a virtual keyboard is shown). This is what we do with our app.
Marc Novakowski
I already did exactly as you said, cause i didn't find solution.I define a resolution depending on the device name.Please post quick solution there if you find it. Thnx for discussion.
Yeti
Max Gontar