List of usage examples for android.os AsyncTask THREAD_POOL_EXECUTOR
Executor THREAD_POOL_EXECUTOR
To view the source code for android.os AsyncTask THREAD_POOL_EXECUTOR.
Click Source Link
From source file:Main.java
public static void Run(Runnable r) { new AsyncTask<Void, Void, Void>() { @Override/* ww w. ja v a 2 s. c o m*/ protected Void doInBackground(Void... params) { r.run(); return null; } }.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); }
From source file:Main.java
/** * Execute task./*from w w w . jav a 2s . c o m*/ * * @param theTask the the task */ @SuppressLint({ "NewApi" }) public static void executeTask(AsyncTask theTask) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) theTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void[]) null); else theTask.execute((Void[]) null); }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) // API 11//from w w w . jav a 2s. c o m public static void executeOnExecutor(AsyncTask<Object, Void, Object> asyncTask) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); else asyncTask.execute(); }
From source file:Main.java
@SuppressLint("NewApi") @TargetApi(Build.VERSION_CODES.HONEYCOMB) public static <T> void executeOnExecutor(AsyncTask<T, ?, ?> task, T... params) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } else {/*from w ww . j ava2s. c o m*/ task.execute(params); } }
From source file:Main.java
@SuppressLint("InlinedApi") public static void execute(AsyncTask<Void, ?, ?> asyncTask) { if (Build.VERSION.SDK_INT <= Build.VERSION_CODES.HONEYCOMB_MR1) { asyncTask.execute();/*from w w w.j av a2 s . co m*/ } else { asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } }
From source file:Main.java
public static <Params, Progress, Result> void executeParallel(AsyncTask<Params, Progress, Result> task, Params... args) {//from w w w . java 2s .c o m if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args); } else { task.execute(args); } }
From source file:Main.java
/** * Execute an {@link AsyncTask} on a thread pool * * @param task Task to execute//from w ww .ja va 2 s.com * @param args Optional arguments to pass to{@link AsyncTask#execute(Object[])} * @param <T> Task argument type */ @SuppressLint("NewApi") public static <T> void execute(AsyncTask<T, ?, ?> task, T... args) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args); }
From source file:Main.java
@SuppressLint("NewApi") 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 {//from w ww.j ava 2 s .c o m task.execute(params); } }
From source file:Main.java
@TargetApi(Build.VERSION_CODES.HONEYCOMB) private static <A, B, C> AsyncTask<A, B, C> executeHoneycomb(AsyncTask<A, B, C> task, A... args) { return task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args); }
From source file:Main.java
@SafeVarargs @TargetApi(Build.VERSION_CODES.HONEYCOMB) private static <T> void honeycombExecuteAsyncTask(AsyncTask<T, ?, ?> task, T... params) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); }