Android Utililty Methods AsyncTask Run

List of utility methods to do AsyncTask Run

Description

The list of methods to do AsyncTask Run are organized into topic(s).

Method

voidexecute(final boolean forceSerial, final AsyncTask task, final T... args)
Execute an AsyncTask on a thread pool
final WeakReference<AsyncTask<T, ?, ?>> taskReference = new WeakReference<AsyncTask<T, ?, ?>>(
        task);
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.DONUT) {
    throw new UnsupportedOperationException(
            "This class can only be used on API 4 and newer.");
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
        || forceSerial) {
...
voidexecute(final boolean forceSerial, final AsyncTask task, final T... args)
Execute an AsyncTask on a thread pool
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.DONUT) {
    throw new UnsupportedOperationException(
            "This class can only be used on API 4 and newer.");
if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB
        || forceSerial) {
    task.execute(args);
} else {
...
voidexecuteAsyncTask(AsyncTask task, T... params)
execute Async Task
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
} else {
    task.execute(params);
voidexecuteAsyncTask(AsyncTask task, T... params)
execute Async Task
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
    task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params);
} else {
    task.execute(params);
ProcessrunSuCommandAsync(String command)
run Su Command Async
DataOutputStream fout = new DataOutputStream(con.openFileOutput(
        SCRIPT_NAME, 0));
fout.writeBytes(command);
fout.close();
String[] args = new String[] {
        "su",
        "-c",
        ". " + con.getFilesDir().getAbsolutePath() + "/"
...