title: Issue with DP calculation on 7" tablet & 7" tablet emulator
body: <p>I am having some problems with the dp calculation for a 7" tablet (800x480px). Below is my way of calculating. Can't find where I am making a mistake in calculation or my thought:</p>
  
  <p>I have three devices that I'm testing:</p>
  
  <ol>
  <li>Nexus One: 800x480px, 3.7" display (<a href="http://www.gsmarena.com/htc_google_nexus_one-3069.php" rel="nofollow noreferrer">specs</a>)</li>
  <li>Huawei Ideos: 320x240px, 2.8" display (<a href="http://www.gsmarena.com/huawei_u8150_ideos-3513.php" rel="nofollow noreferrer">specs</a>)</li>
  <li>Ainol Novo 7" Tablet: 800x480px, 7" display (<a href="http://androidadvices.com/ainol-novo-7-android-40-ice-cream-sandwich-tablet-99-china/" rel="nofollow noreferrer">specs</a>)</li>
  </ol>
  
  <p>Based on the display size, I'm calculating the DPI (dots per inch) manually, based on the formular:</p>
  
  <pre><code>sqrt(w^2 + h^2) / in
  </code></pre>
  
  <p>So I am getting:</p>
  
  <ol>
  <li>Nexus One: sqrt(800*800+480*480)/3.7 = <strong>252.15dpi</strong></li>
  <li>Huawei Ideos: sqrt(320*230+240*240)/2.8 = <strong>142.86dpi</strong></li>
  <li>Ainol Novo 7" Tablet: sqrt(800*800+480*480)/7 = <strong>133.28 dp</strong></li>
  </ol>
  
  <p>Now I want to output the dpi value of the screen metrics and based on that, the screen width and height in dp (density-independent pixels). My code for that is:</p>
  
  <pre><code>    DisplayMetrics metrics = new DisplayMetrics();
      getWindowManager().getDefaultDisplay().getMetrics(metrics);
      Log.d(TAG, "ScaledDensity: " + metrics.scaledDensity);
      Log.d(TAG, "Density DPI: " + metrics.densityDpi);
  
      int widthInPx = 800; // 320 or 800, depending on the respective device width I'm testing
      int widthInDp =(int)(widthInPx/metrics.scaledDensity);
      Log.d(TAG, "width in dp: " + widthInDp);
  
      int heightInPx = 480; // 240 or 480, depending on the respective device height I'm testing
      int heightInDp =(int)(heightInPx/metrics.scaledDensity);
      Log.d(TAG, "height in dp: " + heightInDp);
  </code></pre>
  
  <p>Results are as follows:</p>
  
  <ol>
  <li>Nexus One:
      Scaled Density: 1.5, Density DPI: 240, <strong>Width in dp: 533, Height in dp: 320</strong></li>
  <li>Huawei Ideos: 
      ScaledDensity: 0.75, Density DPI: 120, <strong>width in dp: 426, height in dp: 320</strong></li>
  <li>Ainol Novo 7" tablet: 
      ScaledDensity: 1.0, Density DPI: 160, <strong>width in dp: 800, height in dp: 480</strong></li>
  </ol>
  
  <p>The density DPIs that I get from the java code inside my activity differ from my calculated dpi values and are obviously rounded by Android to one of the values 120, 160 or 240, which is quite normal. No problem so far.</p>
  
  <p><strong>Problem/Question 1:</strong></p>
  
  <p>With the third device, the Novo 7" tablet:
  The ScaledDensity is said to be 1.0, and the width in <strong>dp is said to be 800</strong>, same as the number of px. However, that's not the reality; when I create a fullscreen app and place a view on there, <strong>only 533dp x 320dp of the view actually fit on the screen</strong>. So it's the same dp measurements as the Nexus One; even though the Nexus One has a higher DPI value but the same number of pixels. How is that possible?</p>
  
  <p><strong>Problem/Question 2:</strong></p>
  
  <p>I create an AVD for the emulator, with the exact measurements as the Novo 7" tablet.
  The log lines in my java code show the same values as for the real tablet device:</p>
  
  <ol start="4">
  <li>Ainol Novo 7" tablet <strong>Emulator</strong>: 
      ScaledDensity: 1.0, Density DPI: 160, <strong>width in dp: 800, height in dp: 480</strong></li>
  </ol>
  
  <p>However, on the emulator, I can place a view with <strong>580dp</strong> x 320 dp to to fully visible in a fullscreen activity. How is it possible that the width dp differs between the emulator and the real device with exact same measurements?</p>
  
  <p><img src="https://i.stack.imgur.com/LTma3.png" alt="enter image description here"></p>
  
  <p><strong>Problem/Question 3:</strong></p>
  
  <p>On <a href="http://developer.android.com/guide/practices/screens_support.html" rel="nofollow noreferrer">http://developer.android.com/guide/practices/screens_support.html</a> it says:</p>
  
  <blockquote>
    <p>To help you target some of your designs for different types of</p>
    
    <p>devices, here are some numbers for typical screen widths:</p>
    
    <p>...</p>
    
    <p>480dp: a tweener tablet like the Streak (480x800 mdpi).</p>
    
    <p>600dp: a 7” tablet (600x1024 mdpi).</p>
    
    <p>...</p>
  </blockquote>
  
  <p>I assume my tablet should fall under one of these categories, however, neither does it have 480 width nor 600 dp width, but something in between; in my case, either 533dp (real device) or 580dp (emulator).</p>
  
  <p>If this is the case, what good does such a 'typical screen widths' overview do, if in reality, it doesn't actually seem to be the case but devices from different vendors can have any other random value in between the standard ones?
  Then I could just go ahead and back to working with pixel values again, as the entire benefit of using dp seems to be absent.</p>