Java tutorial
//package com.java2s; import android.content.Context; public class Main { static float density = 1; public static float getDisplayMetricsDensity(Context context) { density = context.getResources().getDisplayMetrics().density; return density; } }