Basically three main device categories exist that Android applications need to support:
- handsets (phones)
- small tablets (7″ category)
- large tablets (10″ and above).
Qualifiers before Android 3.2:
Google’s first attempt at creating qualifiers to separate resources by device was to create a handful of size buckets: small, normal, large, xlarge. Initially, this worked out well as handset devices were in the small/normal category, the first 7″ tablets on the market were large, and the first 10″ tablets were xlarge.
Qualifiers with Android 3.2 onwards:
However, as more and more devices began appearing in the market with new screen sizes and the lines began to blur about where a device might present itself. A new solution to the problem was presented in Android 3.2, in the form of new qualifiers to pick resources based on a devices current width/height or “smallest” width; the latter being a new designation for the devices size by representing it in terms of the width (in density-independent pixels, or dp) of the shortest side of the screen.
Using the new paradigm, it has become common to define small tablets as having a smallest width of 600dp, and large tablets at 720dp, with handsets being everything that falls below that line.
Using qualifiers when minimum support is below 3.2 and target is higher than or equal to 3.2
For applications targeting Android 3.2 or higher as a minimum this new system works well. However, if developers wishing to create an application that runs universal on handsets and tablets are compelled to support a minimum Android version no higher than 2.2, or at best 2.3, then in that case create duplicates of each resource in a directory with the old size qualifier and place it an another directory with a corresponding smallest width qualifier.
E.g. keeping the same dimens.xml
file in values-large
and values-sw600dp
. So the device running on android version lower than 3.2 will take values from values-large
and the device running on android version higher than or equal to 3.2 will take values from values-sw600dp