Android examples for android.os:AsyncTask
execute AsyncTask With Result Boolean
//package com.java2s; import android.annotation.SuppressLint; import android.os.AsyncTask; import android.os.Build; public class Main { @SuppressLint("NewApi") public static void executeWithResultBoolean( AsyncTask<Void, Void, Boolean> task) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else {/*from ww w. j a va2s . c o m*/ task.execute(); } } @SuppressLint("NewApi") public static void execute(AsyncTask<Void, Void, Void> task) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR); } else { task.execute(); } } @SuppressLint("NewApi") public static void execute(AsyncTask<Boolean, Void, ?> task, Boolean params) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, params); } else { task.execute(params); } } }