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 mult
Imagine you have a structure like this:
res/
drawable-mdpi/image.png
drawable-hdpi/image.png
drawable-xhdpi/image.png
layout/main.xml
layout-land/main.xml
layout-xlarge/main.xml
layout-sw600dp/main.xml
and you want to know, which layout is used.
One way would be to put a value in resources:
res/
values-mdpi/strange_info.xml with:
drawable-mdpi
values-hdpi/strange_info.xml with:
drawable-hdpi
values-xhdpi/strange_info.xml with:
drawable-xhdpi
values/strange_info.xml with:
layout
values-land/strange_info.xml with:
layout-land
values-xlarge/strange_info.xml with:
layout-xlarge
values-sw600dp/strange_info.xml with:
layout-sw600dp
In code you just do
String mainFolderName = context.getResources().getString(R.string.main_is_from_folder);
I have some doubts regarding -Xdpi qualifier, but it should work (not tested). Note that with the above structure you will get "drawable-hdpi" on ldpi devices for image.png.