Am 24.08.11 16:21, schrieb Abhi:
> The field type for image column is BLOB. And I have no idea what that
> means. I am trying to figure out a way to retreive BLOB data into my
> Android application and display it on the screen.

write:

ByteArrayOutputStream out = new ByteArrayOutputStream();
Bitmap bitmap = BitmapFactory.decodeStream(in);
bitmap.compress(CompressFormat.JPEG, 60, out);
out.toByteArray(); // save this as BLOB


read:

byte[] image = cursor.getBlob(cursor.getColumnIndex("xyz"));
ByteArrayInputStream is = new ByteArrayInputStream(image);
Drawable drw = Drawable.createFromStream(is, title);
drw.setBounds(0, 0, drw.getIntrinsicWidth(), drw.getIntrinsicHeight());
imageview.setImageDrawable(drw);

-- 
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

Reply via email to