06-11-2013 05:46 PM
In my android app I have some strings and booleans their values depend on the device type (Q10, Z10 or PlayBook)
So I have a directory “res/values-small-square” for Q10 and “res/values-mdpi” for PlayBook and the default “res/values” for Z10
The values are as expected when I run the app on PlayBook but when I run it on Z10 or Q10 it gets the values from “values-mdpi”
Am I doing it the wrong way or Is this a know bug?
Solved! Go to Solution.
06-12-2013 02:59 AM
Your resource directory postfixes seem to be correct. However the documentation mentions only the drawable resource directories and not the values, so your approach might not be supported.
Maybe you could use different keys for the few special strings and reference those from your separate layout-mdpi/-xhdpi/-small-square layout xmls.
06-12-2013 09:37 AM
What I meant is to drop altogether the use of values-mdpi and other different values resources. Merge all your string resources and rename the duplicate entries.
Then from layout-small-square you may reference one values key and from layout-mdpi a different one and so on.
06-12-2013 11:25 AM
After reading and experimenting more I found that this behavior is the expected. As per the Android documentation regarding the pixel density:
“Using a density qualifier does not imply that the resources are only for screens of that density. If you do not provide alternative resources with qualifiers that better match the current device configuration, the system may use whichever resources are the best match.”
So to fix my code I added “values-xhdpi” and now Z10 and Q10 uses this folder and ignores “values-mdpi”
Thanks imre_m, but I need the values to execute some code that is intended only for PlayBook as a workaround for totally a different non UI issue.