public static int convertToDIP ( int pixels ) { return Math . round ( TypedValue . applyDimension ( TypedValue . COMPLEX_UNIT_DIP , pixels , Resources . getSystem ( ) . getDisplayMetrics ( ) ) ) ; }
Returns a density independent pixel value rounded to the nearest integer for the desired dimension .