Android Question Jpeg stored as blob in sqlite

shhammer5634

Member
Licensed User
Longtime User
Hello all,

This is my first post and my first project in B4A. So far I've been able to find the answers to my questions here in the forums. To those who have answered all those questions, my profound thanks.

My issue is this: I'm taking a small jpeg picture and storing it as a blob in a table. That part I've got no problem. And I can reload the image into a byte array from the table. How do I take that byte array which is a jpeg image and get it into an imageview. I'm missing a step somewhere and I don't seem to be able to word my search inquiries well enough to find what I'm looking for.

Thanks for the assistance.

Steve Hammer
 

DonManfred

Expert
Licensed User
Longtime User
B4X:
    Dim image() As Byte ' fill this with the data from your blob (the bytearray)
    Dim ins As InputStream
    ins.InitializeFromBytesArray(image,0,image.Length)
    Dim bmp As Bitmap
    bmp.Initialize2(ins)
Hope you get the principle.
 
Upvote 0

shhammer5634

Member
Licensed User
Longtime User
Hi Don,

I do get the principal, and I've seen this although I haven't tried it. My concern was in defining the image as a bitmap since it's a jpeg. Do I gather that imageview is smart enough to figure out that it's a jpeg?

Thanks
 
Upvote 0
Top