Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

BitmapFactory.decodeResource and drawable* folders

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.)

like image 250
Thomas Calc Avatar asked Aug 01 '12 09:08

Thomas Calc


1 Answers

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.

like image 88
flawyte Avatar answered Oct 23 '22 11:10

flawyte