Code example for AsyncTask

Methods: cancel, getStatus

0
        } 
    } 
 
    @Override 
    public void onDestroy() { 
        if (mTask != null && mTask.getStatus() != AsyncTask.Status.FINISHED) {
            mTask.cancel(true);
        } 
        mTask = null;
 
        super.onDestroy(); 
    } 
 
    @Override 
    public void onProgressUpdate(Integer... values) {
        if (mProgressBar == null) {
            return; 
        } 
        mProgressBar.setIndeterminate(values[0] == values[1] ? true : false);
        mProgressBar.setMax(values[0]);
        mProgressBar.setProgress(values[1]);