0

I read Q&A on how to structure the values folder for multiple screens densities for example here, however I cannot seem to understand what is the difference between these two cases for instance:

Case 1:

res/values-sw320dp-hdpi/dimens.xml    
res/values-sw320dp-xhdpi/dimens.xml    
res/values-sw320dp-xxhdpi/dimens.xml    
res/values-sw320dp-xxxhdpi/dimens.xml  
res/values-sw480dp-hdpi/dimens.xml    
res/values-sw480dp-xhdpi/dimens.xml    
res/values-sw480dp-xxhdpi/dimens.xml    
res/values-sw480dp-xxxhdpi/dimens.xml

...ect

Case 2:

res/values-sw320dp/dimens.xml     
res/values-sw480dp/dimens.xml    
res/values-sw600dp/dimens.xml  
res/values-sw720dp/dimens.xml 

Question: How big of a difference does it make to use or not use the suffix mdpi/hdpi/xhpi/xxhpdi in folder architecture?

Red M
  • 2,609
  • 3
  • 30
  • 50
  • mdpi usual for low end devices so when you load big pictures it can cause outofmemoryexception, happens to me several times.. this is an example.. – Itzik Samara Jul 19 '18 at 16:42
  • This post will help you better than I could. [Click here](https://stackoverflow.com/questions/11581649/about-android-image-and-asset-sizes) – Arjun Jul 19 '18 at 16:45
  • in the cases listed in my question, I have values-swXXXdp as the first appended suffix. Android validates configuration qualifiers in order of precedence, see here: https://developer.android.com/guide/topics/resources/providing-resources#AlternativeResources which means it's already separating it based on its smallest width, so what difference does it make to add the second suffix which is mdpi, hdpi, xhpi, or xxhpdi? – Red M Jul 19 '18 at 16:52

1 Answers1

0

In case 2 you only differentiate it based on smallest width so appropriate width resource file is used.

In case 1, When you use res/values-sw320dp-hdpi it further get's differentiated based on screen density in this case hdpi(240dpi), because minimum 320dp screen's can exist in different density levels.

Man
  • 2,720
  • 2
  • 13
  • 21
  • Okay, let's say for example we have the Android One device that has 480*854 pixels which is equivalent to 320*569 dp because of its 1.5 hdpi density and also we have the HTC One M8 with 1080*1920 equivalent to 360*640 dp because of its 3 xxhdpi density. They will both fall on the values-sw320dp bucket, so will it make a big difference if they each have their own values-sw320dp-hdpi/dimens.xml and values-sw320dp-xxhdpi/dimens.xml respectively? – Red M Jul 19 '18 at 17:56