I am quite confused whether I have to deal with my device, which I'm currently testing my app on, as a medium or large density device. The device is Samsung Galaxy S3 mini with 480 x 800 pixels, 4.0 inches display according to the device specifications provided by Samsung.
I am planning to optimize my drawables such that a wide range of screen sizes and densities are supported. Since S3 mini is my testing device, which launcher icon is actually the one used in it? is it the one under drawable-ldpi, drawable-mdpi, drawable-hdpi or drawable-xhdpi?
Try this way,hope this will help you to solve your problem.
switch (getResources().getDisplayMetrics().densityDpi) {
case DisplayMetrics.DENSITY_LOW:
// write your code here.
break;
case DisplayMetrics.DENSITY_MEDIUM:
// write your code here.
break;
case DisplayMetrics.DENSITY_HIGH:
// write your code here.
break;
case DisplayMetrics.DENSITY_XHIGH:
// write your code here.
break;
case DisplayMetrics.DENSITY_XXHIGH:
// write your code here.
break;
case DisplayMetrics.DENSITY_TV:
// write your code here.
break;
}