How to convert pixels into dip(Density Independent Pixels) in Android

android

Solution

Hope this will be helpful

Resources r = getResources();
float dp = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, 69, r.getDisplayMetrics());

Problem

In my Android application I have pixels(69px) and I need to convert this pixels into dip(Density Independent Pixels). Any suggestions?

Original source