Android Display Density Get getDensity(Context context)

Here you can find the source of getDensity(Context context)

Description

get Density

Parameter

Parameter Description
context a parameter

Declaration

public static float getDensity(Context context) 

Method Source Code

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

public class Main {
    /**/*w w  w.  j a va 2s .co  m*/
     * 
     * @param context
     * @return
     */
    public static float getDensity(Context context) {
        return context.getResources().getDisplayMetrics().density;
    }
}

Related

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