Here you can find the source of getScaledDensity(Context context)
public static float getScaledDensity(Context context)
//package com.java2s; //License from project: Open Source License import android.content.Context; import android.util.DisplayMetrics; public class Main { public static float getScaledDensity(Context context) { DisplayMetrics dm = context.getResources().getDisplayMetrics(); return dm.scaledDensity; }//from w w w . j a v a 2 s.c o m }