BitmapFactory.decodeResource and drawable* folders

50,495

Yes it takes it into account. For example if you do :

Resources res = getContext().getResources();
int id = R.drawable.image; 
Bitmap b = BitmapFactory.decodeResource(res, id);

The bitmap will be different if "image" is present in all of the drawables folders. So I think using the overloaded method decodeResource (Resources res, int id, BitmapFactory.Options opts) will work in the same way.

Share:
50,495
Thomas Calc
Author by

Thomas Calc

Updated on October 01, 2021

Comments

  • Thomas Calc
    Thomas Calc over 2 years

    I am wondering if decodeResource (Resources res, int id, BitmapFactory.Options opts) takes into account the drawable-ldpi,mdpi,hdpi etc. folders.

    I checked the source code, and it doesn't look like that, but I may be missing something.

    (Generally, where are the R.drawable. resolved in Android source? I was unable to find it.)