Android examples for android.os:AsyncTask
Do AsyncTask as Callable
import android.os.AsyncTask; public class Main{ //from w ww. ja v a 2s .co m public static <T> void doAsync(final Callable<T> callable, final Callback<T> callback) { new AsyncTask<Void, Void, T>() { @Override protected T doInBackground(Void... params) { try { return callable.call(); } catch (Exception e) { e.printStackTrace(); } return null; } @Override protected void onPostExecute(T result) { callback.onCallback(result); } }.execute((Void[]) null); } }