android layout – sw600dp quantifier not working on Galaxy Tab-ThrowExceptions

Exception or error:

I have a program with 2 fragments. On tablets I am showing both of them.
I am doing this with /layout-sw600dp folder.
On Motorola Xoom and other tablets it is working but not in Samsung Galaxy Tab 10.1
This is very strange. I have searched everywhere and havent come accross with a person with the same problem?
What can be the reason?

How to solve:

Might as well put this as an answer. The swXXXdp identifiers are only for Android 3.2 and above. If you want to make sure you properly target tablets both post- and pre-3.2, you must use the swXXXdp attribute and large/xlarge attributes. So for an example:

  • /layout/ — for phone devices and portrait tablets
  • /layout-xlarge-land/ for landscape tablets pre-3.2
  • /layout-sw600dp-land/ for landscape tablets post-3.2

Before Honeycomb 3.2, Android used “size buckets” of small (e.g. Wildfire), normal (basically any phone), large (Streak 5, OG Galaxy Tab), xlarge (Xoom), but now ditches them in favour of these dp values which allow finer control.

###

If you need support for 7 inch tables, then it is not xlarge but large:
/layout/ — for phone devices and portrait tablets
/layout-large-land/ for landscape tablets pre-3.2
/layout-sw600dp-land/ for landscape tablets post-3.2

Leave a Reply

Your email address will not be published. Required fields are marked *