Greetings,
I have the problem that I need to consult several web pages, however the code that I have first runs the entire for-next cycle and then passes the control to JobDone, I want is to execute the first element of the for-next cycle to pass the control To jobdone continue with the second element of the for-next
and so on ... i tried this but I did not get it to run one at a time ...
The idea is to have order the results obtained
Html (0) => Log (Job.GetString)
Html (1) => Log (Job.GetString)
Html (i) => Log (Job.GetString)
Another idea is not to use the job.Tag element
thank you.
I have the problem that I need to consult several web pages, however the code that I have first runs the entire for-next cycle and then passes the control to JobDone, I want is to execute the first element of the for-next cycle to pass the control To jobdone continue with the second element of the for-next
and so on ... i tried this but I did not get it to run one at a time ...
The idea is to have order the results obtained
Html (0) => Log (Job.GetString)
Html (1) => Log (Job.GetString)
Html (i) => Log (Job.GetString)
Another idea is not to use the job.Tag element
thank you.
B4X:
Sub Activity_Create(FirstTime As Boolean)
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
For i=0 To 5
job1.Download("https://www.pablo.com"&"/html("&i&")")
Next
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "Job1"
'print the result to the logs
Log(Job.GetString)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub
Last edited: