Problem reading blob

ljcomp

Member
Licensed User
Longtime User
Hi all
I have an error when reading a blob from database.
B4X:
Sub IdView2_ItemClick (Position As Int, Value As Object)
Dim typelook As String
Dim sitetag As String
Dim Idcur3 As Cursor
Dim Buffer() As Byte 
   sitetag = idviewmap.Get(Value)
   If sitetag <> Null Then
   Idcur3 = SQL1.ExecQuery("SELECT * From idents WHERE idents.ID = '" & sitetag & "'")
Idcur3.Position = 0
      IdText2.Text = Idcur3.GetString("site")
      IdText1.Text = Idcur3.Getstring("tag")
      IdText3.Text = Idcur3.GetString("treetype")
       Buffer = Idcur3.GetBlob("image")
    Dim InputStream1 As InputStream
    InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
    
    Dim Bitmap1 As Bitmap
    Bitmap1.Initialize2(InputStream1)
    InputStream1.Close
    Idview1.Bitmap = Bitmap1
      Idcur3.Close
   End If
      
   
End Sub
I think
B4X:
  Bitmap1.Initialize2(InputStream1)
Throws the error. "error loading bitmap"

Any ideas

LJ
 
Top