I'm caching image files as a blob in a SQLite database. I have a similar application on another platform that does the same thing with the same image files. The databases on both platforms report the exact same size for the same images. So I think, but can't guarantee, that the image data is getting into the database intact.
But when I try to create a Drawable, the console prints out "DEBUG/skia(267): --- decoder->decode returned false".
The steps are:
Read the blob into a byte array.
byte[] b = new byte[imageDataCursor.getInt(0)];
b = imageDataCursor.getBlob(1);
Create an InputStream from the byte array.
ByteArrayInputStream is = new ByteArrayInputStream(b);
Create a Drawable from the InputStream. (this is what creates the 'decoder' message above)
Drawable drw = Drawable.createFromStream(is, "articleImage");
Set the ImageView.image to the Drawable.
imgView.setImageDrawable(drw);
So far, no joy. Any suggestions?