I have a new device to port my app to (Kindle Fire HDX)
The DisplayMetrics
dump:
DPI : 320,
wxh 1920x1200,
x,y dpi 324.255x322.966,
scaleddensity 2.0
densityfactor 2.0
What's the most accurate folder "swXXXdp" to place the layout resources? Can I calculate that "XXX" from the displayMetrics?
sw720dp
". sw600dp
"sw600dp
" as well, but I don't fully understand why (as it is a much bigger resolution screen than the other 7")Can anybody shed some light? Thx!
I finally understood the swXXXX thing thanks to everybody's answers and a little research.
sw*XXXX* and sh*XXXX* do indeed mean Smallest Width and Smallest Height available, however the Desity Factor in the Display Metrics affect this value as well.
For instance
the Amazon Kindle Fire HDX 7" has a "raw" resolution of 1920x1200, but the display is Ultra-dense (xhdpi), that's why the density factor is set to 2. So for resources, Android will look in sw(1200/2) == sw600dp.
My older tablet, also 7", has a raw resolution of 1024x600, but the display is less dense, so DisplayMetrics return a density factor of 1, and the associated resource folder will be sw(600/1)dp == sw600dp
The new "retina-like" 10" screens have a resolution around 2560x1600, but then again, the density factor is 2, so they're equivalent, when it comes to swXXXX layouts, to 1280x720 screens with density factor=1 (ie. Galaxy Tab): The folder is sw720dp in both cases.
So although the layout folders are the same, Bitmap resources will be fetched according to the density code, which is different. The modern tablets I describe use xhdpi, while the older ones use mdpi or hdpi -can't remember right now-. This is why the final thing works: Same layouts use density-independent dimensions, and load density-dependent bitmaps. The final omelette tastes delicious!