Code example for View

Methods: getResources

0
     * @param view 
     * @param dp 
     * @return pixels 
     */ 
    public static float getPixels(final View view, final int dp) {
        return getPixels(view.getResources(), dp);
    } 
 
    /** 
     * Get pixels from dps 
     * 
     * @param resources 
     * @param dp 
     * @return pixels 
     */ 
    public static float getPixels(final Resources resources, final int dp) {
        return TypedValue.applyDimension(COMPLEX_UNIT_DIP, dp,
                resources.getDisplayMetrics());
    }