Example usage for android.os AsyncTask executeOnExecutor

List of usage examples for android.os AsyncTask executeOnExecutor

Introduction

In this page you can find the example usage for android.os AsyncTask executeOnExecutor.

Prototype

@MainThread
public final AsyncTask<Params, Progress, Result> executeOnExecutor(Executor exec, Params... params) 

Source Link

Document

Executes the task with the specified parameters.

Usage

From source file:Main.java

public static void executeOnExecutor(AsyncTask<Void, Void, Void> asyncTask) {
    asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, (Void) null);
}

From source file:Main.java

/**
 * Execute an {@link AsyncTask} on a thread pool
 *
 * @param task Task to execute//  w  ww .  jav a 2 s . c om
 * @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

@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);
}

From source file:Main.java

@SafeVarargs
public static <Params, Progress, Result> void StartAsyncTask(AsyncTask<Params, Progress, Result> asyncTask,
        Params... params) {/*  w w w  .  j  ava  2  s .c  om*/
    asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
}

From source file:Main.java

/**
 * Execute task.//w  w  w  .j  a  v a  2  s. com
 *
 * @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

public static <T> void StartAsyncTask(AsyncTask asyncTask, T... params) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
    else//from  w w w .j a v  a 2  s . co m
        asyncTask.execute(params);
}

From source file:Main.java

public static void start(AsyncTask task) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, new Void[] {});
    } else {/*from w w  w  . jav a  2  s  .  c  o m*/
        task.execute(new Void[] {});
    }
}

From source file:Main.java

public static void execute(AsyncTask task, Object... args) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, args);
    } else {/*ww  w  . j  a v  a  2 s . co m*/
        task.execute(args);
    }
}

From source file:Main.java

public static void startMyTask(AsyncTask asyncTask, Object... params) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB)
        asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
    else//  w w w  . ja va  2s  .  c  o  m
        asyncTask.execute(params);
}