How to convert an array of bytes to a bitmap image?

Asked

Viewed 706 times

0

Hello, I am trying to return to an Imageview an image stored in the database that is saved as an array of bytes in a field of type BLOB, what would be the alternatives to this?

1 answer

1

After fetching the image in the database and saving in the array variable, you can convert to Bitmap this way:

    Bitmap bitmapImage = BitmapFactory.decodeByteArray(array, 0, array.length);

If the method fails to do the conversion, it will return null.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.