Convert Pixel value into dp value
<p>Actually am able to find the screen width using getWindowManager().getDefaultDisplay(). Now i want to know how can i get value in dp from the value that i got which is in pixel. For example suppose i got width of the screen using-</p>

<p><strong>code used for getting width</strong></p>

<pre><code>Display display = getWindowManager().getDefaultDisplay();

int width= display.getWidth();
</code></pre>

<p>Now the width i got is in pixel, how do i convert it into dp. </p>

<p>Please help me to solve this out. I have seen in the android documentation but don't get to know how to implement it.</p>
