I have problem with the Wait For in B4i, it goes back to the calling procedure instead of waiting for the Job:
So I tried with a sample from
www.b4x.com
Gives me :
Over
And not Title and Content from DownloadQuote
Any help, please
So I tried with a sample from
[B4X] OkHttpUtils2 with Wait For
Downloading resources is simpler with the new Resumable Subs feature. Using Wait For we can wait for the JobDone event in the same sub that started the download. No longer is it needed to have a single sub that handles all requests results. Simplest example: Dim j As HttpJob j.Initialize(""...

B4X:
Sub btnSend_Click
DownloadQuote
log("Over")
End Sub
Sub DownloadQuote
Dim j As HttpJob
j.Initialize("", Me) 'name is empty as it is no longer needed
j.Download("http://quotesondesign.com/wp-json/posts?filter[orderby]=rand")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
'The result is a json string. We parse it and log the fields.
Dim jp As JSONParser
jp.Initialize(j.GetString)
Dim quotes As List = jp.NextArray
For Each quot As Map In quotes
Log("Title: " & quot.Get("title"))
Log("Content: " & quot.Get("content"))
Next
End If
j.Release
End Sub
Gives me :
Over
And not Title and Content from DownloadQuote
Any help, please