Android Question Why my Jobdone sub is never reach?

Riv

Member
Licensed User
Hy Experts and active members, why my Jobdone sub is never reach?
 

Riv

Member
Licensed User
I can't imagin that there are no other people on the forum with same problem. Here's my code.

In my activity :

Sub Blabla

Dim sJ As HttpJob
Dim sReq As String

sReq = Main.pHandler.soGetRequest("***", "***")

sJ.Initialize("sJ", Me)
sJ.PostString(Main.ui, sReq)

end Sub

Sub JobDone(Job As HttpJob)

If Job.JobName = "sJ" Then

If Job.Success Then

Main.pHandler.swResponse(Job.GetString)
End If

END Sub
 
Upvote 0

Misterbates

Active Member
Licensed User
How is the JobDone sub linked to the HttpJob object? If the "sJ" in the Initialize call is the event name for callbacks, then sub JobDone should be declared as sub sJ_JobDone (at least, that's how callbacks normally work).
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
what is this sReq = Main.pHandler.soGetRequest("***", "***") doing and what is the content of sReq ?

and what about main.ui ?
 
Upvote 0

Riv

Member
Licensed User
what is this sReq = Main.pHandler.soGetRequest("***", "***") doing and what is the content of sReq ?

Sending a json request to a server with two parameters.

And Mister bates, what i maked up out of the httpUtils tut. Is that Js is a HttpJob object
 
Upvote 0

sorex

Expert
Licensed User
Longtime User
if that json request is async the code after it is already executed before your request has fetched the data.

you should call the post in the json request event
 
Upvote 0

Misterbates

Active Member
Licensed User
Mister bates, what i maked up out of the httpUtils tut. Is that Js is a HttpJob object

My point is that there is no obvious connection between your Js instance and your JobDone sub. Normally, the event name is the link, but it requires you to declare your JobDone sub as <eventname>_JobDone - in your example, you would declare Js_JobDone as the sub name, so that the HttpJob object can find the sub to raise the event.
 
Upvote 0

Riv

Member
Licensed User

Thank you for the reply. I tryed the
if that json request is async the code after it is already executed before your request has fetched the data.

you should call the post in the json request event

Thanks Sorex,
My Hanlder is a is code file and not a activity. And my experience as a newbie is that the httpjob doesn't work in a code file.
 
Upvote 0

Riv

Member
Licensed User

Thanks you,

I tryed js_JobDone but still i can't reach the sub.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…