How i can use JobDone in a Class like this:
I thought it was that way, but not executed Job Done.
What am I wrong?
I found only one similar to this thread but no solution.
https://www.b4x.com/android/forum/threads/httputils2-doesnt-call-jobdone-in-classes.26360/
Edit: It is solved. It was my mistake, I was running with breakpoints and line by line and never saw the entry into the method. For the triggers of the event JobDone, this can't be tracking in this way.
But if the project runs without any breakpoint works well, also can be checked using logs or breakpoints within jobdone.
@DonMandFred Thanks for your help and interest.
PD: Attached project already running
B4X:
'Class module
Sub Class_Globals
Private labelLocal As Label
End Sub
'Initializes the object. You can add parameters to this method if needed.
Public Sub Initialize (labelTemp As Label)
labelLocal=labelTemp
End Sub
Public Sub downloadInfo ' i call this method from a Button1
ProgressDialogShow("Getting country")
remoteQuery("SELECT name FROM countries WHERE id='MX'", "name")
End Sub
Private Sub remoteQuery(query As String, nombreJob As String)
Dim job As HttpJob
job.Initialize(nombreJob,Me )
job.PostString("http://www.b4x.com/android/countries.php", query)
End Sub
Sub JobDone(Job As HttpJob)
ProgressDialogHide
If Job.Success Then
Dim res As String
res=Job.GetString
Log("Server response: " & res)
Dim parser As JSONParser
parser.Initialize(res)
Select Job.JobName
Case "name"
Dim l As List
l= parser.NextArray
If l.Size = 0 Then
labelLocal.Text="Not download name"
Else
Dim m As Map
m= l.Get(0)
labelLocal.Text= m.Get("name")
End If
End Select
Else
ToastMessageShow("Error: " & Job.ErrorMessage,True)
End If
Job.Release
End Sub
What am I wrong?
I found only one similar to this thread but no solution.
https://www.b4x.com/android/forum/threads/httputils2-doesnt-call-jobdone-in-classes.26360/
Edit: It is solved. It was my mistake, I was running with breakpoints and line by line and never saw the entry into the method. For the triggers of the event JobDone, this can't be tracking in this way.
But if the project runs without any breakpoint works well, also can be checked using logs or breakpoints within jobdone.
@DonMandFred Thanks for your help and interest.
PD: Attached project already running
Attachments
Last edited: