Java tutorial
//package com.java2s; //License from project: Apache License import android.app.Activity; public class Main { public static float[] getScreen_dpi(Activity context) { float[] array = new float[2]; array[0] = context.getResources().getDisplayMetrics().xdpi; array[1] = context.getResources().getDisplayMetrics().ydpi; return array; } }