08-17-2010 04:24 AM
I am using a 9530 to do development. there is a peculiar behaviour for my application. I will try to summarize
1. display main screen A
2. select option to display another screen B
3. pop screen B and push screen A, after input of data
4. Display.getHeight() when re-initializing the content of screen A returns the height of screen B instead of screen A.
This is a problem as screen B has a keyboard, for user input, so Display.getHeight returns half of the actual screen size. I tried Display.getVerticalResolution() and it returns me a constant value. But it is in pixels.
Do i add on the keyboard height? Or is there anyway for me to get the full height by some other function?
08-17-2010 04:47 AM
That sounds like it still thinks screen B is being displayed.
Could you cache the height of the screen in your class for screen A and use the cached value rather than asking the OS for the height?
08-17-2010 05:31 AM
i can do that but it would not be a very good method to implement. especially if i were to tilt the device etc. Currently i'm getting the model for the device and then using hardcoded values as a workaround. Anyone got any ideas?
08-17-2010 05:45 AM
I agree, its not a very good method for the reasons you state. You would have to re-query the dimensions when the device rotates to get the new screen dimensions.
It sounds like your code still thinks the wrong screen is being displayed. Do you have any sample code?
08-17-2010 08:19 PM
This method lies in my Util class to retrieve the Display height
public static int getScreenHeight()
int ht = Display.getHeight();
The code below lies in my screen B. The variable prevScreen referes to screen A.
if (null != prevScreen)
After this is done, when i do a Util.getScreenHeight() , it returns me the height of screen B, taking the height of the keyboard into account.