Created
November 26, 2014 05:23
-
-
Save januprasad/37603d8b261d113fd909 to your computer and use it in GitHub Desktop.
TaskHelper to execute multiple asynctask same time
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
public class TaskHelper { | |
public static <P, T extends AsyncTask<P, ?, ?>> void execute(T task) { | |
execute(task, (P[]) null); | |
} | |
public static <P, T extends AsyncTask<P, ?, ?>> void execute(T task, P... params) { | |
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { | |
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