The below code in B4XTable1_DataUpdated sub works, but it seems very inefficient as the query to display the imageview with the blob has to be run for every record on the visible ids. Is there a better way to get the blobs, convert to bmp and display onto the imageviews.
Table structure: ID INTEGER AUTOINCREMENT, COUNTRY TEXT , FLAG BLOB
Thank you
B4X:
Sub B4XTable1_DataUpdated
For i = 0 To B4XTable1.VisibleRowIds.Size - 1
Dim RowId As Long = B4XTable1.VisibleRowIds.Get(i)
Dim pnl As B4XView = FlagsColumn.CellsLayouts.Get(i + 1)
Dim iv As B4XView = pnl.GetView(1)
If RowId > 0 Then
Dim row As Map = B4XTable1.GetRow(RowId)
Dim cursor1 As Cursor
cursor1=Starter.SQL1.ExecQuery("SELECT FLAG FROM " & Starter.DBTableName & " WHERE ID =" & row.Get("ID"))
cursor1.Position=0
Dim buffer() As Byte =cursor1.GetBlob("FLAG")
iv.SetBitmap(BytesToImage(buffer))
cursor1.Close
Else
iv.SetBitmap(Null)
End If
Next
End Sub
Thank you