Code example for FutureTask

Methods: cancel

0
        return mCancelled.get();
    } 
 
    public final boolean cancel(boolean mayInterruptIfRunning) {
        mCancelled.set(true);
        return mFuture.cancel(mayInterruptIfRunning);
    } 
 
    public final Result get() throws InterruptedException, ExecutionException { 
        return mFuture.get();
    } 
 
    public final Result get(long timeout, TimeUnit unit)
            throws InterruptedException, ExecutionException, TimeoutException { 
        return mFuture.get(timeout, unit);
    } 
 
    public final LifoAsyncTask<Params, Progress, Result> execute( 
            Params... params) {
        return executeOnExecutor(sDefaultExecutor, params);
    }