Code example for Future

Methods: cancel, isCancelled

0
 
    public void cancel() { 
        if (!isCancelled()) { 
            // Here we do not want to force the task to be interrupted. Indeed, 
            // it may be useful to keep the result in a cache for a further use 
            mFuture.cancel(false);
            if (mCallback != null) {
                mCallback.onImageRequestCancelled(this);
            } 
        } 
    } 
 
    public final boolean isCancelled() { 
        return mFuture.isCancelled();
    } 
 
    private class InnerCallback implements ImageLoaderCallback { 
 
        public void onImageLoadingStarted(ImageLoader loader) {
            if (mCallback != null) {
                mCallback.onImageRequestStarted(ImageRequest.this);