0

I am stuck while detecting tablet or smartphone. I have the application that should work on tablet as well as phone. I am not able to conclude how to code to detect the device. I have created the layouts for both tablet and phone.

I want to use is Tablet().

Ramesh R
  • 6,683
  • 3
  • 22
  • 34
Shruti
  • 9
  • 1

1 Answers1

0

values/string.xml

<bool name="is_tablet">false</bool>

values/sw900dp/sting.xml or values/sw600dp/string.xml or values/sw720dp/string.xml

<bool name="is_tablet">true</bool>

check this;

 boolean isTablet = getResources().getBoolean(R.bool.is_tablet);

If it's " dimen", you can put it in dimen.

Hasan Kucuk
  • 1,591
  • 5
  • 16
  • 33