public interface

# Continuation

com.google.android.gms.tasks.Continuation<TResult, TContinuationResult>

## Class Overview

A function that is called to continue execution after completion of a `Task`.

##### See Also

- `continueWith(Continuation)`
- `continueWithTask(Continuation)`

## Summary

Public Methods
abstract TContinuationResult | then(Task<TResult> task) Returns the result of applying this Continuation to `task`.

## Public Methods

#### public abstract TContinuationResult then (Task<TResult> task)

Returns the result of applying this Continuation to `task`.

To propagate failure from the completed Task call `getResult()` and allow the `RuntimeExecutionException` to propagate. The RuntimeExecutionException will be unwrapped such that the Task returned by `continueWith(Continuation)` or `continueWithTask(Continuation)` fails with the original exception.

To suppress specific failures call `getResult(Class)` and catch the exception types of interest:

     task.continueWith(new Continuation<String, String>() {
         @Override
         public String then(Task<String> task) {
             try {
                 return task.getResult(IOException.class);
             } catch (FileNotFoundException e) {
                 return "Not found";
             } catch (IOException e) {
                 return "Read failed";
             }
         }
     }

To suppress all failures guard any calls to `getResult()` with `isSuccessful()`:

     task.continueWith(new Continuation<String, String>() {
         @Override
         public String then(Task<String> task) {
             if (task.isSuccessful()) {
                 return task.getResult();
             } else {
                 return DEFAULT_VALUE;
             }
         }
     }

##### Parameters

task | the completed Task. Never null

##### Throws

Exception | if the result couldn't be produced