title: Wrong display width and height in Android
body: <p>I have a screen size of 600 (width) x 1024 (height). I get current width 600 but incorrectly get height 976 (without rotated screen). I get current width 1024 but wrong get height 552 (with rotated screen).  </p>
  
  <pre><code> int rowPixelWidth = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getWidth();
                  int rowWidth =  (int)Math.floor(rowPixelWidth / this.getResources().getDisplayMetrics().density);
                  int rowPixelheight = ((WindowManager) getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getHeight();
                  int rowheight =  (int)Math.floor(rowPixelheight / this.getResources().getDisplayMetrics().density);
                  Log.d("rowWidth","rowWidth"+rowWidth);
                  Log.d("rowheight","rowheight"+rowheight);
  -------------------------------------------------------------
   &lt;uses-sdk
          android:minSdkVersion="3"
          android:targetSdkVersion="8" /&gt;
      &lt;supports-screens android:anyDensity="true"/&gt;
  -------------------------------------------------------------
  </code></pre>
  
  <p>What's wrong with this code?</p>
  
  <p>Here are some numbers for typical screen widths:  </p>
  
  <ol>
  <li>320dp: a typical phone screen (240x320 ldpi, 320x480 mdpi, 480x800 hdpi, etc).  </li>
  <li>480dp: a tweener tablet like the Streak (480x800 mdpi).   </li>
  <li>600dp: a 7” tablet (600x1024 mdpi).  </li>
  <li>720dp: a 10” tablet (720x1280 mdpi, 800x1280 mdpi, etc).  </li>
  </ol>
  
  <p>I get current width but not get current height for all device (without (320x480 screen).   </p>
  
  <p>I try code from <a href="https://stackoverflow.com/questions/1016896/android-how-to-get-screen-dimensions/1016941#1016941">Get screen dimensions in pixels</a> but same occur problem.</p>