All of the examples I've seen for getting data are of this format:
However I want to handle downloaded data from two URLs in diferent ways, eg. one is JSON while the other is HTML and so obvioulsy need two different jobdone handlers.
I presume I need to use the second parameter of the Initialize member given the documentation describes it as the TargetModule - The activity or service that will handle the JobDone event.
So how do I point to the two different jobdone event handlers?
B4X:
Sub Button_MouseClicked (EventData As MouseEvent)
Dim job As HttpJob
job.Initialize("GetData", Me)
job.Download(Page)
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success Then
Log(Job.GetString)
Else
Log("Job Error: " & Job.ErrorMessage)
End If
Job.ReleaseEnd
Sub
However I want to handle downloaded data from two URLs in diferent ways, eg. one is JSON while the other is HTML and so obvioulsy need two different jobdone handlers.
I presume I need to use the second parameter of the Initialize member given the documentation describes it as the TargetModule - The activity or service that will handle the JobDone event.
So how do I point to the two different jobdone event handlers?