Java tutorial
//package com.java2s; //License from project: Apache License import android.content.Context; public class Main { /** * get density of screen * * @param context Context * @return */ public static float getDensity(Context context) { return context.getApplicationContext().getResources().getDisplayMetrics().density; } }