Android examples for android.os:AsyncTask
execute AsyncTask Serially
//package com.java2s; import android.annotation.SuppressLint; import android.os.AsyncTask; import android.os.Build; public class Main { public static <Params, T extends AsyncTask<Params, ?, ?>> void executeSerially( T task) {/*from w w w.jav a2 s .co m*/ executeSerially(task, (Params[]) null); } @SuppressLint("NewApi") public static <Params, T extends AsyncTask<Params, ?, ?>> void executeSerially( T task, Params... params) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.HONEYCOMB) { task.executeOnExecutor(AsyncTask.SERIAL_EXECUTOR, params); } else { task.execute(params); } } }