- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello,
I'm trying to find the best known methods for distinguishing a tablet from a phone.
We recently discovered that a Tablet device (Thundersoft Bamboo) was getting a phone version of an App in the Google Play store instead of an alternate version more suited for tablets. After contacting the ISV we learned that the reason was that they distinguish a phone from a tablet based on screen properties. Specifically for the Bamboo:
getResources().getConfiguration().screenLayout = Configuration.SCREENLAYOUT_SIZE_NORMAL
Which they equate to being a phone.
Are there other methods that we can recommend to distinguish between a phone and a tablet that are not based on screen checks?
- Tags:
- Android* OS
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
This is my method:
public static boolean isTablet(Context ctx){ return (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK) >= Configuration.SCREENLAYOUT_SIZE_LARGE; }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Another method that I do not consider it necessary to implement on my apps but is good to use is using "Size Qualifiers", it works only in Android 3.2 and later
http://developer.android.com/training/multiscreen/screensizes.html#TaskUseSizeQuali
for example:
defining a variable type bool in default layout.xml
res/values-large/layout.xml:
<resources> <bool name="isTablet">false</bool> </resources>
and in res/values-sw600dp/layout.xml and res/values-xlarge/layout.xml
<resources> <bool name="isTablet">true</bool> </resources>
So, from your app you will check if your mobile device is a Tablet:
boolean isTablet = getResources().getBoolean(R.bool.isTablet); if isTablet { // true } else { // false }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks Jorge, I will look into your suggestions and see how they work on the Bamboo device.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page