Android Question Cancel a HttpJob

Fusseldieb

Active Member
Licensed User
Longtime User
Hi all,
I'm making Http-Post Requests on my app and receive them in the Sub "JobDone". How can I cancel the event, when the user presses the "BACK" button?
Because if I don't cancel the Job and the user has already exited the Activity, the Activity re-opens and causes a bug opening and closing the Activity infinitely.

Thanks in advance ;)
 

Fusseldieb

Active Member
Licensed User
Longtime User
Stopservice("httputils2service") should do it.
It doesn't work. It gives me the error:
java.lang.ClassNotFoundException: my.app.httputils2service

EDIT: I am using:
B4X:
Sub ExecuteRemoteQuery(query As String, JobName As String)
        Dim jobs As HttpJob
        jobs.Initialize(JobName, Me)
        jobs.PostString("XXXXXXXXXXXXXXXXX/include/config.php", query)
     
    End Sub

EDITIT: I have now used:
B4X:
StopService(HttpUtils2Service)
But when I press the back button and the app passes through this code, the app crashes with an NullPointerException.
 
Last edited:
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
i dont think that he is using the httputils2-SERVICE. I believe he uses the normal httputils2-lib (not the service)
 
Upvote 0
Top