0

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?

Murray9654
  • 27
  • 6

1 Answers1

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