Is there a way to check if the user is using a tablet or a phone? I\'ve got problems with my tilt function and my new tablet (Transformer)
As it has been mentioned before, you do not want to check whether the device is a tablet or a phone but you want to know about the features of the device,
Most of the time, the difference between a tablet and a phone is the screen size which is why you want to use different layout files. These files are stored in the res/layout-
directories. You can create an XML file in the directoy res/values-
for each of your layouts and put an int/bool/string resource into it to distinguish between the layouts you use.
File res/values/screen.xml
(assuming res/layout/
contains your layout files for handsets)
phone
File res/values-sw600dp/screen.xml
(assuming res/layout-sw600dp/
contains your layout files for small tablets like the Nexus 7)
7-inch-tablet
File res/values-sw720dp/screen.xml
(assuming res/layout-sw720dp/
contains your layout files for large tablets like the Nexus 10):
10-inch-tablet
Now the screen type is accessible via the R.string.screen_type
constant.