Welcome!

Welcome to the official BlackBerry Support Community Forums.

This is your resource to discuss support topics with your peers, and learn from each other.

inside custom component

Android™ Runtime Development

Reply
New Contributor
maag008
Posts: 8
Registered: ‎03-25-2013
My Device: BB10
Accepted Solution

Why BB10 is using values-mdpi?

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?

 

Thanks

Please use plain text.
Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: Why BB10 is using values-mdpi?

Hello,

 

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.

 

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.
Please use plain text.
New Contributor
maag008
Posts: 8
Registered: ‎03-25-2013
My Device: BB10

Re: Why BB10 is using values-mdpi?

That would be correct if Z10 and Q10 ignore “values-mdpi”, but they are getting the strings and booleans from “values-mdpi” and ignore the default "values"

Please use plain text.
Trusted Contributor
imre_m
Posts: 160
Registered: ‎11-17-2010
My Device: PlayBook, Z10, Q10

Re: Why BB10 is using values-mdpi?

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.

--
If you find this post useful please Like it.
If it solves your problem please mark as solution.
Please use plain text.
New Contributor
maag008
Posts: 8
Registered: ‎03-25-2013
My Device: BB10

Re: Why BB10 is using values-mdpi?

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.

Please use plain text.