Android examples for User Interface:Screen Resolution
get Screen Density Dpi
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; public class Main { public static int getScreenDensityDpi(Context context) { DisplayMetrics metrics = context.getApplicationContext() .getResources().getDisplayMetrics(); return (int) (metrics.density * 160); }/*from w w w . j a v a 2s .c o m*/ }