Java tutorial
//package com.java2s; //License from project: Open Source License import android.annotation.SuppressLint; import android.os.AsyncTask; public class Main { /** * Execute an {@link AsyncTask} on a thread pool * * @param task Task to execute * @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); } }