Code example for FutureTask

Methods: get

0
     *         while waiting. 
     * @throws TimeoutException If the wait timed out. 
     */ 
    public final Result get(long timeout, TimeUnit unit) throws InterruptedException,
            ExecutionException, TimeoutException { 
        return mFuture.get(timeout, unit);
    } 
 
    /** 
     * Executes the task with the specified parameters. The task returns 
     * itself (this) so that the caller can keep a reference to it. 
     * 
     * This method must be invoked on the UI thread. 
     * 
     * @param params The parameters of the task. 
     * 
     * @return This instance of AsyncTaskEx. 
     * 
     * @throws IllegalStateException If {@link #getStatus()} returns either 
     *         {@link AsyncTaskEx.Status#RUNNING} or {@link AsyncTaskEx.Status#FINISHED}. 
     */