question: public float convertDpToPixels ( float dp , Context context ) { Resources resources = context . getResources ( ) ; DisplayMetrics metrics = resources . getDisplayMetrics ( ) ; float px = dp * ( metrics . densityDpi / 160f ) ; return px ; }
target:  Converts dp unit to equivalent pixels, depending on device density.