Here you can find the source of getDensitySize(Context context, int size)
public static int getDensitySize(Context context, int size)
//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; } }