Android examples for User Interface:Display
get Dpi
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; public class Main { private static Context mContext; public static String getDpi() { String info;/*from w ww.j a v a 2 s . c om*/ DisplayMetrics metric = mContext.getResources().getDisplayMetrics(); int width = metric.widthPixels; int height = metric.heightPixels; float density = metric.density; int densityDpi = metric.densityDpi; info = "width:" + width + " height:" + height + " d:" + density + " dpi:" + densityDpi; return info; } }