Android examples for Phone:Screen
get Screen Type
//package com.java2s; import android.content.Context; import android.util.DisplayMetrics; public class Main { public static String getScreenType(Context mContext) { try {//w ww .j av a 2s. c om final int densityDpi = mContext.getResources() .getDisplayMetrics().densityDpi; switch (densityDpi) { case DisplayMetrics.DENSITY_LOW: return "ldpi"; case DisplayMetrics.DENSITY_MEDIUM: return "mdpi"; case DisplayMetrics.DENSITY_TV: return "tv"; case DisplayMetrics.DENSITY_HIGH: return "hdpi"; case DisplayMetrics.DENSITY_XHIGH: return "xhdpi"; case DisplayMetrics.DENSITY_XXHIGH: return "xxhdpi"; default: return String.valueOf(densityDpi); } } catch (Throwable e) { return "unknown"; } } }