title: Android: how to calculate dp?
body: <p>I know there are N threads about this question, but I still don't know how to apply width and height for Widgets (buttons, images) on Android.</p>
  
  <p>I have read this: <a href="http://developer.android.com/guide/practices/screens_support.html" rel="nofollow">http://developer.android.com/guide/practices/screens_support.html</a>
  and many other threads, but I don't understand it.</p>
  
  <p>How am I supposed to calculate dpi for a button?</p>
  
  <p>Am I need to know the dpi of the device? (Wikipedia list):
  <a href="http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density" rel="nofollow">http://en.wikipedia.org/wiki/List_of_displays_by_pixel_density</a></p>
  
  <p>But there are plenty other devices with different dpi's!</p>
  
  <p>I have a design in photoshop (800x480), and a button (290x65). I have saved and imported the image button in the newly created 'drawable' folder in my android project. In XML (layout) I inserted the ImageView with the imported button image.</p>
  
  <pre><code>&lt;ImageView
     android:id="@+id/btnNewImage"
     android:layout_width="210dp"
     android:layout_height="50dp"
     android:layout_marginLeft="10dp"
     android:layout_marginTop="7dp"
     android:src="@drawable/new_image" /&gt;
  </code></pre>
  
  <p>The image inserted is completely different, it's much more bigger. How am I supposed to calculate the exact width and height values for Android sizes?</p>