Example usage for android.os AsyncTask THREAD_POOL_EXECUTOR

List of usage examples for android.os AsyncTask THREAD_POOL_EXECUTOR

Introduction

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

Prototype

Executor THREAD_POOL_EXECUTOR

To view the source code for android.os AsyncTask THREAD_POOL_EXECUTOR.

Click Source Link

Document

An Executor that can be used to execute tasks in parallel.

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

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 {/*www .  j a  va2s  .  com*/
        task.execute(args);
    }
}

From source file:Main.java

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

From source file:Main.java

private static <Params, Progress, Result> void executeAsyncTask(AsyncTask<Params, Progress, Result> task,
        Params... params) {//from   www . ja  v a 2  s  . co  m
    if (Build.VERSION.SDK_INT >= 11) {
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
    } else {
        task.execute(params);
    }
}

From source file:Main.java

public static <Params, Progress, Result> void executeAsyncTask(AsyncTask<Params, Progress, Result> task,
        Params... params) {/*from  w  ww  .  j a va  2 s  . c  om*/
    if (Build.VERSION.SDK_INT >= 11) {
        task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
    } else {
        task.execute(params);
    }
}

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/*from  w ww .  j  a va2s. c om*/
        asyncTask.execute(params);
}

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  ww  . ja  v  a 2  s .  co m
        asyncTask.execute(params);
}

From source file:Main.java

public static ThreadPoolExecutor getThreadPoolExecutor() throws Throwable {
    return AsyncTask.THREAD_POOL_EXECUTOR instanceof ThreadPoolExecutor
            ? ((ThreadPoolExecutor) AsyncTask.THREAD_POOL_EXECUTOR)
            : null;//from   ww w .  java 2  s.c  o  m
}

From source file:Main.java

public static <Params, Progress, Result> void exe(AsyncTask<Params, Progress, Result> asyncTask,
        Params... params) {/*from   w w  w  .  j  ava 2 s . com*/
    if (Build.VERSION.SDK_INT >= 11) {
        asyncTask.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
    } else {
        asyncTask.execute(params);
    }
}

From source file:Main.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static <T> void executeTask(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  av a  2 s  . c  o  m
        task.execute(params);
    }
}