Android - ImageView: setImageBitmap VS setImageDrawable

Viewed 71165

What is the difference between setImageBitmap and setImageDrawable?

I have an image which I would like to set dynamically from file. The tutorial that I followed says to convert my Bitmap to a BitmapDrawable then set it using setImageDrawable. I've notice that setting the Bitmap directly with setImageBitmap also works but I don't notice any difference.

Bitmap image = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
BitmapDrawable bitmapDrawable = new BitmapDrawable(image);
imageView.setImageDrawable(bitmapDrawable);

OR

Bitmap image = BitmapFactory.decodeFile(imgFile.getAbsolutePath());
imageView.setImageBitmap(image);
5 Answers
Related