//https://developer.android.com/about/dashboards/index.html#Screens private static String getDensityName(DisplayMetrics dm) { float density = dm.density; if (density >= 4.0) { return "xxxhigh density"; } if (density >= 3.0) { return "xxhigh density"; } if (density >= 2.0) { return "xhigh density"; } if (density >= 1.5) { return "high density"; } if (density >= 1.0) { return "medium density"; } return "low density"; }