I am running remote audio-file-fetching and audio file playback operations in a background thread using AsyncTask. A Cancellable progress bar is sh
If you're doing computations:
isCancelled() periodically.If you're doing a HTTP request:
HttpGet or HttpPost somewhere (eg. a public field).cancel, call request.abort(). This will cause IOException be thrown inside your doInBackground.In my case, I had a connector class which I used in various AsyncTasks. To keep it simple, I added a new abortAllRequests method to that class and called this method directly after calling cancel.