I 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 a width of the screen using this code:
Display display = getWindowManager().getDefaultDisplay();
int width = display.getWidth();
Now the width I got is in pixel, how do I convert it into dp.
Please help me to solve this out. I have seen in the android documentation but don't get to know how to implement it.
 
     
     
     
    