Assign SQL Blob to an Image view

Cableguy

Expert
Licensed User
Longtime User
How do I assignd the contents of a SQL Blob to an Imageview?
 

Cableguy

Expert
Licensed User
Longtime User
Ok, so I started trying to solve this one by myself, as I always do...
I came up with this:

B4X:
      Buffer = Cursor1.GetBlob("Image")
      Dim Canvas1 As Canvas
      Canvas1.Initialize(ImageView1)
      Dim IN As InputStream
      IN.InitializeFromBytesArray(Buffer,0,Buffer.Length)
      IN.Close
      Msgbox(buffer.Length,"Image lenght")
      Msgbox(In.BytesAvailable,"available")
      Canvas1.Bitmap.Initialize2(IN)
      ImageView1.Bitmap = Canvas1.Bitmap

I use the two message boxes to be sure that the inputstream has the same size as the Buffer...so far so good, but I get a system exceptions tell me that it cannot load the image...I'm thinking bout 80% of my code i correct, and my logical thinking too, but I cannot see were is the fault for the Blob to not show
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Sorry, missed that... still, my code is very similar, almost identical, so waht is my mistake?
the only ajor diference I can see is the closing of the stream, being done AFTER assigning it to the Imageview...

Edit:
I just tryed the sample code, duelly altered to match my needs, and I get the exact same error...
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
think so, wen I compile I get a big Smiley as the activity background...


I'm thinking this is somethisngdue to my db...
I am using SQLite Administrator, has I've always done...
Can you point me to any other ease to use db creator/edito/admin free software?
 
Upvote 0

Cableguy

Expert
Licensed User
Longtime User
Done! It turns out to be something in the way SQLite Adinistrator handles the Blob fields...
All working now, Thanks EREL!
 
Upvote 0

aklisiewicz

Active Member
Licensed User
Longtime User
Is there any example how to load BLOB images into a ListView or ScrollView instead, or perhaps some other method to diplay several images (that user can scroll Up/Down OR Left/Right) ?

Arthur
 
Upvote 0
Top