Android - Loopj Cancel Handling Result

249 views Asked by At

I'm using loopj (http://loopj.com/android-async-http/) library in my android projects.

I show a dialog message in onFail() if there's an error in my http call. But when user has bad network connection and if clicks back without waiting the result of call, in prev fragment error dialog appears.

I want to cancel handling result of http call if user navigates out of activity or fragment. Can you suggest a proper way to handle this?

Thanks.

1

There are 1 answers

0
peko On BEST ANSWER

You can override onPause() in your fragment and call cancelAllRequests on your AsyncHttpClient.