Skip to content

Instantly share code, notes, and snippets.

@deepankarb
Created March 25, 2015 08:13
Show Gist options
  • Save deepankarb/845d4c4e1cb89ee9db61 to your computer and use it in GitHub Desktop.
Save deepankarb/845d4c4e1cb89ee9db61 to your computer and use it in GitHub Desktop.
public static void cancelAsyncTask(AsyncTask<?, ?, ?> task) {
if (task == null) {
return;
}
if (!task.getStatus().equals(AsyncTask.Status.FINISHED)) {
Logger.debug(TAG, "Cancelling AsyncTask " + task.toString() );
task.cancel(true);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment