Question

I'm currently developping my app to be compatible with the samsung multi window feature introduced with the galaxy note 2 and soon the galaxy s3. If you don't know what I'm talking about :
(source: androidheadlines.com)

If you are interested, here is a link to know how to do it : here

My problem is that I need to know the height/width that my app uses. I'm doing this :

displaymetrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(displaymetrics);
heightScreen = displaymetrics.heightPixels;
widthScreen = displaymetrics.widthPixels;

But this returns the size of the entire screen, not just the part that my app uses. My activity is only compose by a Panel which take the entire space, but the panel.getHeight() or getWidth() return 0.

How can I get the real height/width ?

Thanks in advance.

Was it helpful?

Solution

My activity is only compose by a Panel which take the entire space, but the panel.getHeight() or getWidth() return 0.

Try checking later. You are probably checking for this in onCreate(), which is too soon AFAIK.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top