Created
October 31, 2013 11:03
-
-
Save daichan4649/7247903 to your computer and use it in GitHub Desktop.
AsyncTask の重複起動チェック(Activity/Fragment#onResume 内で行う場合の例)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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