Probably I'm repeating the same question but I haven't found solution to this problem & many of the same questions are still un-answered. So , here is my question :
I have implemented PHP backend where user can upload pictures in any image format & it will be saved as BLOB in MySQl database . To retrieve these images on Android device I have prepared JSON response in which these images are in form of base64 strings.
PHP Code :
$rightScrollImage= base64_encode($row['right_image']);
Now, on the Android side these image will be saved in SQLite database & here is
CODE TO INSERT IMAGE :
rightScrollImage.setRightimagedata(Base64.decode(row.getString("rightScrollerImage"), 0));
WHERE datatype for this field in SQLite also as BLOB.
CODE TO DISPLAY IMAGE :
byte[] imageData = cursor.getBlob(cursor.getColumnIndex(DatabaseManager.RIGHT_IMAGE));
Bitmap bitmap = BitmapFactory.decodeByteArray(imageData, 0, imageData.length);
imageStream.reset();
holder.imageView.setImageBitmap(bitmap);
Problem with this code is it can decode few images & those which are not displayed got error of "D/skia: --- decoder->decode returned false" .