Reflecting on the “new” intercepted directories (for example, values-sw600dp), I created this method based on the screen width "DP:
protected static boolean isSmartphone(Activity act){ DisplayMetrics metrics = new DisplayMetrics(); act.getWindowManager().getDefaultDisplay().getMetrics(metrics); int dpi = 0; if (metrics.widthPixels < metrics.heightPixels){ dpi = (int) (metrics.widthPixels / metrics.density); } else{ dpi = (int) (metrics.heightPixels / metrics.density); } if (dpi < TABLET_MIN_DP_WEIGHT) return true; else return false; } public static final int TABLET_MIN_DP_WEIGHT = 450;
And in this list you will find some of the DP popular devices and tablet sizes:
Wdp / hdp
GALAXY Nexus: 360/567
XOOM: 1280/752
GALAXY NOTE: 400/615
NEXUS 7: 961/528
GALAXY TAB (> 7 & <10): 1280/752
GALAXY S3: 360/615
Wdp = Width dp
Hdp = Height dp
source share