Hi is there a system propert to know on which device the JVM is running. It is to know whether it is a mobile or tablet in android?
Asked
Active
Viewed 497 times
0
-
also check this: http://stackoverflow.com/questions/11330363/how-to-detect-device-is-android-phone-or-android-tablet – Caner Mar 28 '13 at 14:43
-
sorry. I found the answer on other post that u specified. Thanks. – Murray9654 Mar 28 '13 at 15:02
1 Answers
0
or you can use DisplayMetric properties (width, height), to find if the device is tab/mobile.
DisplayMetrics metrics = new DisplayMetrics();
getWindowManager().getDefaultDisplay().getMetrics(metrics);
int width = metrics.widthPixels;
int height = metrics.heightPixels;
if (SharedCode.width > 1023 || SharedCode.height > 1023){
//code for big screen (like tablet)
}else{
//code for small screen (like smartphone)
}

Zeeshan
- 2,884
- 3
- 28
- 47