Private Sub FillCLV
Private ResultSet1 As ResultSet
Private Query As String
Query = "SELECT ID, Fish, date, location, image FROM fishcaught"
ResultSet1 = Starter.SQL1.ExecQuery(Query)
Do While ResultSet1.NextRow
Private Buffer() As Byte 'declare an empty byte array
Buffer = ResultSet1.GetBlob2(4)
Private InputStream1 As InputStream
InputStream1.InitializeFromBytesArray(Buffer, 0, Buffer.Length)
Private bmp As Bitmap
bmp.Initialize2(InputStream1)
InputStream1.Close
CLV1.Add(CreateItem(CLV1.AsView.Width, ResultSet1.GetString2(0), ResultSet1.GetString2(1), ResultSet1.GetString2(2), ResultSet1.GetString2(3), bmp), "")
Loop
End Sub
Private Sub CreateItem(Width As Int, ID As String, Fish As String, Date As String, Location As String, Image As Bitmap) As Panel
Private p As B4XView = xui.CreatePanel("")
Private Height As Int = 82dip
p.SetLayoutAnimated(0, 0, 0, Width, Height)
p.LoadLayout("Card1")
lblID.Text = ID
lblFish.Text = Fish
lblDate.Text = Date
lblLocation.Text = Location
Image = Image.Resize(imvFish.Width, imvFish.Height, True)
imvFish.SetBitmap(Image)
Return p
End Sub