Android Display Density Get getDensitySize(Context context, int size)

Here you can find the source of getDensitySize(Context context, int size)

Description

get Density Size

Declaration

public static int getDensitySize(Context context, int size) 

Method Source Code

//package com.java2s;
import android.content.Context;

public class Main {

    public static int getDensitySize(Context context, int size) {
        return (int) getDensity(context) * size;
    }//  w w  w  .ja  v  a 2 s  .  co  m

    /**
     * 
     * @param context
     * @return
     */
    public static float getDensity(Context context) {
        return context.getResources().getDisplayMetrics().density;
    }
}

Related

  1. getDensity(Context context)
  2. getBounds(Display d, Rect r)
  3. applyDimension(int unit, float value, DisplayMetrics metrics)
  4. getDisplayPPI()