Android Question Download and process Multiple text files with okhttputils2

GeoffT660

Active Member
Licensed User
Longtime User
I am able to download and import one text file into sqlLite but am having difficulty downloading and processing multiple files sequentially from the same MenuItem_Click event because, it appears, the sub has to complete and exit before the httpjob Job Done is called. I can do one table or the other but will only process the last one when calling sequentially. I was hoping to call

B4X:
Sub RcvUpdate_Click
  SyncTable("wcJobLog")
  SyncTable("wcUdfAsTbl")
End Sub

Which would call:
*This calls a web service to create a text file
B4X:
downloadCSV.Initialize("CSV",Me)
downloadCSV.Download(strGet)

Which then waits for the download to complete and then calls JobDone:

B4X:
Sub JobDone (job As HttpJob)
    If job.Success = True Then
        Select job.JobName
            Case "CSV"
*This Downloads the file after it's been created
                HandleCSV(job)
            Case "csvfile"
*This imports the file into the sqlLite db
                HandleFile(job)
        End Select
    Else
        Log("Login failed :" & job.ErrorMessage)
        ToastMessageShow("Failed to communicate with Server", True)
    End If

    job.Release

End Sub

How can I accomplish downloading and processing multiple files?
 
Cookies are required to use this site. You must accept them to continue using the site. Learn more…