Android display.getWidth/height returning wrong sizes for device?
<p>I have a small class that needs to keep track of the devices width and height.</p>

<pre><code>public class BrScreenMetrics {
public static int screenX=0;
public static int screenY=0;

public static void setMetrics(Activity activity)
{ 

    WindowManager w = activity.getWindowManager();
    Display d = w.getDefaultDisplay(); 
    screenX = d.getWidth(); 
    screenY = d.getHeight(); 


}
</code></pre>

<p>}</p>

<p>With each new activity i unvoke the line:</p>

<pre><code>BrScreenMetrics.setMetrics(this);
</code></pre>

<p>which updates the values on rotation etc... This works great, except that it is returning 320x522, not my desire's 480x800.
What am i doing wrong?</p>

<p>Slight Update:</p>

<p>I tried it with this code as well using androids own metrics class:</p>

<pre><code>    public static void setMetrics(Activity activity)
{ 
   DisplayMetrics metrics = new DisplayMetrics();
   activity.getWindowManager().getDefaultDisplay().getMetrics(metrics);      
   screenX = metrics.widthPixels;
   screenY = metrics.heightPixels;

}
</code></pre>

<p>but it is still 320x522 :(</p>
