Code example for AsyncTask

Methods: cancelgetStatus

0
     * @param mayInterruptIfRunning <tt>true</tt> if the thread executing this 
     *        task should be interrupted; otherwise, in-progress tasks are allowed 
     *        to complete. 
     */ 
    public static void cancelTask(AsyncTask<?, ?, ?> task, boolean mayInterruptIfRunning) {
        if (task != null && task.getStatus() != AsyncTask.Status.FINISHED) {
            task.cancel(mayInterruptIfRunning);
        } 
    } 
 
    public static class GCUtils { 
        private static final String TAG = "GCUtils";
        public static final int GC_TRY_COUNT = 2;
        // GC_TRY_LOOP_MAX is used for the hard limit of GC wait, 
        // GC_TRY_LOOP_MAX should be greater than GC_TRY_COUNT. 
        public static final int GC_TRY_LOOP_MAX = 5;
        private static final long GC_INTERVAL = DateUtils.SECOND_IN_MILLIS;
        private static GCUtils sInstance = new GCUtils();
        private int mGCTryCount = 0;
 
Connect your IDE to all the code out there  Get Codota for Java