Issue
I've different sizes of images available under drawable, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi etc.. and I'm using below snippet to retrieve the images' resource id in my android app.
int resid = res.getIdentifier("com.mypackage:drawable/" + selectedItem.getImageName(), null, null);
imageFilePath = "com.mypackage:drawable/" + selectedItem.getImageName();
does this pick the ID of the appropriate resource based on the screen size of the device that runs the application ? (eg:- pick the drawable resource when running in an android phone and pick the drawable-xxhdpi when running in an android tab)
Solution
Yes, if the respective resource files (in my case images) are in the respective folders (drawable, drawable-hdpi, drawable-xhdpi, drawable-xxhdpi etc) getIdentifier method picks the respective image depending on the device that is running the app.
Answered By - Asanga Dewaguru
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.