Reputation: 2223
Hello I am store the image in database as blob and retrive the image from database in string. now i want to set this image in imageview. i tried to convert it in bitmap but not displayed it.i have done my code like this.plz help thanks in advance
in log i am sowing that format of photo:[ B@4052b078 ]
byte[] imageAsBytes = Base64.decode(sp_photo.getBytes(), 0);
alert_photo.setImageBitmap(BitmapFactory.decodeByteArray(imageAsBytes, 0, Bytes.length));
here sp_photo is my string path of photo. and alert_photo is the imageview. plz tell me
Upvotes: 1
Views: 5292
Reputation:
Try this, it might work:
BitmapFactory.Options options = new BitmapFactory.Options();
options.inDither = false;
options.inPurgeable = true;
options.inInputShareable = true;
options.inTempStorage = new byte[1024 *32];
Bitmap bm = BitmapFactory.decodeByteArray(imageAsBytes, 0, imageAsBytes.length, options);
alert_photo.setImageBitmap(bm);
Upvotes: 2
Reputation: 403
try this example code for this...
http://code.google.com/p/android-newbie-sourcecode/source/browse/trunk/ImageToDatabase/?r=6
Upvotes: 0