I got the following piece of code from https://www.b4x.com/android/forum/threads/b4x-okhttputils2-with-wait-for.79345/#content
It works fine.
Now I have a Code Module named functions. I want to add a function like the following:
But B4A IDE says "Static Code Modules can't handle events"
B4X:
Dim j As HttpJob
j.Initialize("", Me)
j.Download("https://www.google.com")
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Log(j.GetString)
End If
j.Release
It works fine.
Now I have a Code Module named functions. I want to add a function like the following:
B4X:
Sub GetLatestNews(activity As Object) As Boolean 'ignore
Dim job As HttpJob
job.Initialize("",activity)
job.Download("http://MyUrl/api/news")
Wait For (job) JobDone(job As HttpJob)
If job.Success Then
'Some Code here
End If
job.Release
End Sub
But B4A IDE says "Static Code Modules can't handle events"