The Android Developer Challenge is back! Submit your idea before December 2.

Tasks

public final class Tasks
extends Object

java.lang.Object
   ↳ com.google.android.play.core.tasks.Tasks


Task utility methods.

Summary

Public methods

static <ResultT> ResultT await(Task<ResultT> task, long timeout, TimeUnit unit)

Blocks until the specified Task is complete.

static <ResultT> ResultT await(Task<ResultT> task)

Blocks until the specified Task is complete.

static Task<Void> whenAll(Collection<? extends Task<?>> tasks)

Returns a Task that completes successfully when all of the specified Tasks complete successfully.

Inherited methods

From class java.lang.Object

Public methods

await

ResultT await (Task<ResultT> task, 
                long timeout, 
                TimeUnit unit)

Blocks until the specified Task is complete.

Parameters
task Task

timeout long

unit TimeUnit

Returns
ResultT the Task's result

Throws
ExecutionException if the Task fails
InterruptedException if an interrupt occurs while waiting for the Task to complete
TimeoutException if the specified timeout is reached before the Task completes

await

ResultT await (Task<ResultT> task)

Blocks until the specified Task is complete.

Parameters
task Task

Returns
ResultT the Task's result

Throws
ExecutionException if the Task fails
InterruptedException if an interrupt occurs while waiting for the Task to complete

whenAll

Task<Void> whenAll (Collection<? extends Task<?>> tasks)

Returns a Task that completes successfully when all of the specified Tasks complete successfully. Does not accept nulls.

The returned Task would fail if any of the provided Tasks fail. The returned Task would be set to canceled if any of the provided Tasks is canceled and no failure is detected.

Parameters
tasks Collection

Returns
Task<Void>

Throws
NullPointerException if any of the provided Tasks are null