How to convert a byte array to a bitmap image?

0
Hello, I am trying to return an ImageView stored in the database which is saved as an array of bytes in a BLOB field, what would be the alternatives for this?

    
asked by anonymous 18.11.2017 / 20:47

1 answer

1

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

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

If the method fails to convert, it returns null.

    
21.11.2017 / 13:29