Skip to content

Instantly share code, notes, and snippets.

@daichan4649
Created October 31, 2013 11:03
Show Gist options
  • Save daichan4649/7247903 to your computer and use it in GitHub Desktop.
Save daichan4649/7247903 to your computer and use it in GitHub Desktop.
AsyncTask の重複起動チェック(Activity/Fragment#onResume 内で行う場合の例)
private TestTask mTask = null;
@Override
public void onResume() {
super.onResume();
if (mTask != null) {
Status taskStatus = mTask.getStatus();
if (taskStatus == AsyncTask.Status.RUNNING) {
// task is running
return;
}
}
mTask = new TestTask();
mTask.execute();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment