Java tutorial
//package com.java2s; import android.os.AsyncTask; public class Main { public static void cancelAsyncTaskArray(AsyncTask[] dataTasks) { if (dataTasks != null) { for (int i = 0; i < dataTasks.length; i++) { if (dataTasks[i] != null && dataTasks[i].getStatus() != AsyncTask.Status.FINISHED) dataTasks[i].cancel(true); } dataTasks = null; System.gc(); } } }