I want to display an image which is saved into database in blob form on my Android. I am using ImageView as image container. Please suggest me something soon.
Regards, Rahul
An SQL BLOB is a built-in type that stores a Binary Large Object as a column value in a row of a database table. By default drivers implement Blob using an SQL locator(BLOB) , which means that a Blob object contains a logical pointer to the SQL BLOB data rather than the data itself.
A Binary Large Object ( BLOB ) is a MySQL data type that can store binary data such as images, multimedia, and PDF files.
Basically there are two options:
in both cases you can easily convert InputStream to bitmat data in a way:
InputStream is; //stream pointing to your blob or file
//...
imageView=new ImageView(this);
imageView.setScaleType(ImageView.ScaleType.CENTER_INSIDE);
imageView.setAdjustViewBounds(true);
imageView.setImageBitmap(BitmapFactory.decodeStream(is));
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With