Android Question HttpJob and JobDone

gerardguerin

Member
Licensed User
Longtime User
Hi,

I probably missing something, if someone can point me in the good direction

This my code:
B4X:
Sub btnTest_Click
   Dim ProductNo As String
   Dim job1 As HttpJob
    
   job1.Initialize("ProductCheck", Me)
JobToDo = 10
   For N = 1 To 10
      ProductNo = N
       job1.PostString("http://xxxx.com/scripts/product_check.php", "PNUM=" & ProductNo )  
    Next   
End Sub

Sub JobDone(Job As HttpJob)
   Dim res As String

   If Job.Success = True Then 
     Select Job.JobName
       Case "ProductCheck"
         res = Job.GetString
         Log(res)
         JobToDo = JobToDo -1     
     End Select
   Else
     Log("Error: " & Job.ErrorMessage)
   End If

   If JobToDo = 0 Then
     Job.Release
   End If
End Sub

The php script just respond a echo of the request, this normal for now, but my problem is I just get the last response 10 times. Any idea?
 

gerardguerin

Member
Licensed User
Longtime User
replace it with

B4X:
Job.Release
Not just release the job when 0... Always release it as you started 10 jobs and not just 1...

I have try that too, but I got this error:
java.io.FileNotFoundException: /data/data/com.humanisoft.collecte/cache/8: open failed: ENOENT (No such file or directory)
 
Upvote 0

Similar Threads

Cookies are required to use this site. You must accept them to continue using the site. Learn more…