Issue
Is there a way to know exactly which layout (and other resources) are chosen by Android during runtime based on screen density and size when supporting multiple screens?
I need to know the folder's name.
EDIT:
I need to know the folder's name programmatically.
Solution
If you're just doing this for debugging purposes, I'd recommend doing something like this: For each qualifier that you have a layout/drawable for, have a values folder with the same qualifier (e.g. if you have a layout-hdpi, also have a values-hdpi to match). Add a strings.xml for each of these folders, and define a string:
In values-hdpi
:
<string name="folder_name">hdpi</string>
In values-xhdpi
:
<string name="folder_name">xhdpi</string>
Then just resolve the string when you need it, and it will tell you which folder was selected.
Answered By - Kevin Coppock
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.