Android Question What is the effect of httpJob if placed inside the function?

Hanz

Active Member
hello,

I understand that an httpJob is a resumablesub which means other functions below it will execute even it is not finished except when placed inside if job.Success statement. But, what is the effect of httpJob if placed inside the function? Is there a difference if the function returns a resumablesub?

B4X:
private sub Foo()
    Dim job As HttpJob
    job.Initialize("", Me)
   job.Download(....)
  Wait For (job) JobDone(job As HttpJob)
   If job.Success Then
   end if
end sub

B4X:
private sub Bar() as ResumableSub
    Dim job As HttpJob
    job.Initialize("", Me)
   job.Download(....)
  Wait For (job) JobDone(job As HttpJob)
   If job.Success Then
   end if
end sub

What's the effect of each code above assuming they are called first before the rests of the codes as in below:

B4X:
Foo()
code1()
code2()

B4X:
Bar()
code1()
code2()

For the Foo(), will code1() wait for Foo() to finish before it executes since Foo() is not ResumableSub although inside it is the httpJob which is a ResumableSub?

Thanks!
 
Top