I am trying to update a listview with information from a table. I have a book and an author and then the cover of the book. I wanted to add each book with those details to the listview.
In the logs, everything loops through the mySQL database very well and gets all the records. However, the httputils2 will only download the last record.
Here is my code:
For public globals:
When the button is pressed:
Then in the Job Done:
I have no idea how to make the image appear on the listview for each item in my table. I tried Loops and timers and still can not figure it out. Any modifications to this code I have?
In the logs, everything loops through the mySQL database very well and gets all the records. However, the httputils2 will only download the last record.
Here is my code:
For public globals:
B4X:
Dim curbookcase as int
When the button is pressed:
B4X:
Dim mh1 As MysqlHandler
Dim rs1 As ResultSet
mh1.Initialize("ALL MY CONNECTION INFO")
If mh1.isConnected = False Then
Msgbox(mh1.SQLError, "Connection Error:")
Return
End If
rs1 = mh1.Query("SELECT * FROM `bookdb` WHERE `drama` LIKE 'yes' LIMIT 0 , 30")
If rs1.IsInitialized = False Then
Msgbox("ResultSet is empty" & CRLF & mh1.SQLError, "Warning")
Return
End If
release_dljpg
flagload = False
Listview1.Clear
Listview1.Clear
If flagload = False Then
For i=0 To rs1.RowCount - 1
rs1.Position = i
curbookcase = 0
Do While curbookcase = 0
gbook = rs1.GetString2("bookname")
gbookauthor = rs1.GetString2("author")
dljpg(i).Initialize(rs1.GetString2("bookname"), Me)
dljpg(i).Download(rs1.GetString2("imglink"))
Loop
Next
End If
Then in the Job Done:
B4X:
If Job.Success = False Then
Job.Release
Return
End If
'------------------------------------------------
Select Job.JobName
Case curbookcase
If Job.Success = False Then
Job.Release
Return
End If
If Job.Success = True Then
Bitmap1.Initialize3(Job.GetBitmap)
Listview1.AddTwoLinesandBitmap(gbook, "By: " & gbookauthor, Bitmap1)
Job.release
End If
Return
'---------------------------------------------
curbookcase = 1
End Select
I have no idea how to make the image appear on the listview for each item in my table. I tried Loops and timers and still can not figure it out. Any modifications to this code I have?