Java tutorial
//package com.java2s; import android.annotation.SuppressLint; import android.os.AsyncTask; import android.os.Build; public class Main { /** * Execute task. * * @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); } }