jeudi 9 juillet 2015

How to handle OutOfMemory Exception while creating a Bitmap from image fetched from SQLite DB?

I have primarily a question,Can I set a byte[] as image in ImageView without converting back to Bitmap?

The OOM error is thrown when I decode the byte[] to bitmap and I am seeing this happening for images of 300 KB even. I have opted to use BitmapFactory.options (inSampleSize) to scale the image to avoid the exception.

But this alters the dimension (width especially) of my image which looks so bad in my application. Is there anyway to fetch the original image from DB without scaling or altering the image (of course without the risk of OOM error)??

Any help is appreciated..!!

Thanks in Advance.

Aucun commentaire:

Enregistrer un commentaire