Hi all,
I have a problem.
I read data from a DB MySql using HttpJob.
Then I have a loop to read several items from DB
For each item I need to get a picture from an URL (the name of the picture is in the DB)
To get item I need to use HttpJob Download.
Then my result is on Jobdone again.
But how can I return to the prior loop to read next item?
There is another way to get a picture from URL?
Here the code:
Thanks
Marco
I have a problem.
I read data from a DB MySql using HttpJob.
Then I have a loop to read several items from DB
For each item I need to get a picture from an URL (the name of the picture is in the DB)
To get item I need to use HttpJob Download.
Then my result is on Jobdone again.
But how can I return to the prior loop to read next item?
There is another way to get a picture from URL?
Here the code:
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim jobx As HttpJob
Main.Qry="Select * FROM sp01negozi where sp01key>'0' order by sp01key"
jobx.Initialize("Job0", Me)
jobx.PostString(Main.ServerUrl, Main.Qry)
End Sub
Private Sub RiempiItem
For i = 0 To Main.rows.size - 1
m = Main.rows.Get(i)
sp01immagine = m.Get("sp01immagine")
job3.Initialize("Job3", Me)
job3.Download("http://www.b4x.com/forum/images/categories/android.png")
.......
.......
.......
next
End Sub
Sub JobDone (Job As HttpJob)
If Job.Success = True Then
Select Job.JobName
Case "Job0"
Dim parser As JSONParser
Dim response As String
response = Job.GetString
parser.Initialize(response)
Main.rows = parser.NextArray
RiempiItem
Case "Job3"
'show the downloaded image
??????
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Thanks
Marco