How can I adapt the code in Custmlistview to load an image and text from a remote MySQL database?
Here is an example code (b4j) where I load one image from the database.
https://www.b4x.com/android/forum/threads/b4x-xui-customlistview-lazy-loading-virtualization.87930/
Here is an example code (b4j) where I load one image from the database.
B4X:
Sub GetRecord
Dim req As DBRequestManager = CreateRequest
Dim cmd As DBCommand = CreateCommand("czytaj2",Null)
Wait For (req.ExecuteQuery(cmd, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j, "req")
Wait For (req) req_Result(res As DBResult)
If res.Rows.Size > 0 Then
Dim row() As Object = res.Rows.Get(a)
Label1.Text = row(res.Columns.Get("col1"))
Label2.Text = row(res.Columns.Get("col2"))
Label3.Text = row(res.Columns.Get("col3"))
Dim ima As B4XBitmap
ima = BytesToImage(row(res.Columns.Get("image")))
ImageView1.SetImage(ima)
Else
Log("ERROR: " & j.ErrorMessage)
End If
End If
j.Release
End Sub
Public Sub BytesToImage(bytes() As Byte) As B4XBitmap
Dim In As InputStream
In.InitializeFromBytesArray(bytes, 0, bytes.Length)
Dim bmp As Image
bmp.Initialize2(In)
Return bmp
End Sub
Sub Button3_Click
a=a+1
If a =10 Then a=0
GetRecord
End Sub
https://www.b4x.com/android/forum/threads/b4x-xui-customlistview-lazy-loading-virtualization.87930/