Created
January 16, 2013 14:11
-
-
Save ikew0ng/4547352 to your computer and use it in GitHub Desktop.
executeAsyncTask
This file contains 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
/** | |
* 使用{@link AsyncTask.THREAD_POOL_EXECUTOR} 执行AsyncTask 这样可以避免android | |
* 4.0以上系统 每次只执行一个 asyncTask | |
* | |
* @param task | |
* @param params | |
*/ | |
public static <Params, Progress, Result> void executeAsyncTask( | |
AsyncTask<Params, Progress, Result> task, Params... params) { | |
if (VERSION.SDK_INT >= 11) { | |
task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); | |
} else { | |
task.execute(params); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment