Search code examples
androidbitmapfactoryimagedecoder

ImageDecoder vs BitmapFactory


With android Pie a new Class is available to handle bitmap and drawable operation. Previously i used BitmapFactory in my most application to handle bitmap operations.

My question is

Should i start using ImageDecoder?, how ImageDecoder is better then the BitmapFactory?

it's given that

"ImageDecoder class, which provides a modernized approach for decoding images"

but official document don't saying much about this

if anyone used this class, can explain what will be advantage of using this ImageDecoder class?

here is the official documentation where i found it


Solution

  • The new ImageDecoder api is much more powerful and supports a variety of different types. It can handle assets, gifs, resources, drawables and much more. You can pass it many different kinds of types and it will take care of converting them to Drawables or Bitmaps for you.

    Here are some guides to get you started: