I am using different code for Mobile and Tablets. Using the following code to check for mobile or tablet:
final float scale = context.getResources().getDisplayMetrics().density;
final float deviceWidth;
if (context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_PORTRAIT) {
deviceWidth = context.getResources().getDisplayMetrics().widthPixels / scale;
} else {
deviceWidth = (context.getResources().getDisplayMetrics().heightPixels / scale);
}
return deviceWidth >= 600;
I am using Huawei AGS Q09 - 10" tablet, which is 157 ppi density (MDPI device) It should be detected as tablet. But it gives 1.5 as device density (which is HDPI), Is there any possibilities for this changes?