tags:

views:

127

answers:

1

Hi,

I have a ListView. I populate it with 8 items, that's all that fits vertically on the G1. Some of my users are saying the Droid has a taller screen height, and so I can probably add one or two more items to the ListView to take up the additional space provided.

How could I measure the available height the screen offers at startup, before the UI is displayed? If I see the height can fit more than 8 items, I'd like to add one or two more rows,

Thanks

A: 

I agree to the comments made above, but if you really want to go down that road, try this:

Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
int height = display.getHeight();

You can do that from your main activity, the one that's started from the launcher.

However, this does not take into account the space taken by the notification bar or window decorations, so in reality, you have less space than width times height.

Matthias