kyawsanwin
kyawsanwin

Reputation: 23

Display images into grid view in android application

I stored the images into the databases with blob type. I want to display those images into grid view. I'm a newbie in android. Any idea?

Upvotes: 0

Views: 1614

Answers (1)

Joeblackdev
Joeblackdev

Reputation: 7327

BitmapFactory.decodeByteArray will do the trick. see this answer - byte[] to image android which is more or less the same as what you want to do. Read the blob from your database in

byte[] blob = cursor.getBlob(cursor.getColumnIndex("yourimageblob")); 
Bitmap bmp=BitmapFactory.decodeByteArray(blob,0,blob.length);
ImageView image=new ImageView(this);
image.setImageBitmap(bmp);

To then show the images in gridview, the answer is here - Showing Images in GridView

Hope this helps

Upvotes: 1

Related Questions