A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://developers.google.com/android/reference/com/google/android/gms/tasks/Tasks below:

Tasks | Google Play services

Stay organized with collections Save and categorize content based on your preferences.

public final class Tasks

Task utility methods.

Summary Public methods static TResult <TResult> await(@NonNull Task<TResult> task)

Blocks until the specified Task is complete.

static TResult <TResult> await(
    @NonNull Task<TResult> task,
    long timeout,
    @NonNull TimeUnit unit
)

Blocks until the specified Task is complete.

static @NonNull Task<TResult> <TResult> call(@NonNull Callable<TResult> callable)

This method is deprecated.

Use TaskCompletionSource instead, which allows the caller to manage their own Executor.

static @NonNull Task<TResult> <TResult> call(
    @NonNull Executor executor,
    @NonNull Callable<TResult> callable
)

This method is deprecated.

Use TaskCompletionSource instead, which allows the caller to manage their own Executor.

static @NonNull Task<TResult> <TResult> forCanceled()

Returns a canceled Task.

static @NonNull Task<TResult> <TResult> forException(@NonNull Exception e)

Returns a completed Task with the specified exception.

static @NonNull Task<TResult> <TResult> forResult(TResult result)

Returns a completed Task with the specified result.

static @NonNull Task<Void> whenAll(@Nullable Task[] tasks)

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

static @NonNull Task<Void> whenAll(@Nullable Collection<Task<Object>> tasks)

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

static @NonNull Task<List<Task<Object>>> whenAllComplete(@Nullable Task[] tasks)

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

static @NonNull Task<List<Task<Object>>> whenAllComplete(@Nullable Collection<Task<Object>> tasks)

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

static @NonNull Task<List<Task<Object>>> whenAllComplete(Executor executor, @Nullable Task[] tasks)

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

static @NonNull Task<List<Task<Object>>> whenAllComplete(
    Executor executor,
    @Nullable Collection<Task<Object>> tasks
)

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

static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(@Nullable Task[] tasks)

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

static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(@Nullable Collection<Task<Object>> tasks)

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

static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(Executor executor, @Nullable Task[] tasks)

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

static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(
    Executor executor,
    @Nullable Collection<Task<Object>> tasks
)

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

static Task<T> <T> withTimeout(@NonNull Task<T> task, long timeout, @NonNull TimeUnit unit)

Returns a new Task which will return a TimeoutException if a result is not returned within the specified time period.

Public methods
public static TResult <TResult> await(@NonNull Task<TResult> task)

Blocks until the specified Task is complete.

Returns TResult

the Task's result

public static TResult <TResult> await(
    @NonNull Task<TResult> task,
    long timeout,
    @NonNull TimeUnit unit
)

Blocks until the specified Task is complete.

Returns TResult

the Task's result

public static @NonNull Task<TResult> <TResult> call(@NonNull Callable<TResult> callable)
This method is deprecated.

Use TaskCompletionSource instead, which allows the caller to manage their own Executor.

Returns a Task that will be completed with the result of the specified Callable.

If a non-Exception throwable is thrown in the callable, the Task will be failed with a RuntimeException whose cause is the original throwable.

The Callable will be called on the main application thread.

public static @NonNull Task<TResult> <TResult> forResult(TResult result)

Returns a completed Task with the specified result.

public static @NonNull Task<VoidwhenAll(@Nullable Task[] tasks)

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

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

public static @NonNull Task<VoidwhenAll(@Nullable Collection<Task<Object>> 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.

public static @NonNull Task<List<Task<Object>>> whenAllComplete(@Nullable Task[] tasks)

Returns a Task with a list of Tasks that completes successfully when all of the specified Tasks complete. This Task would always succeed even if any of the provided Tasks fail or canceled. Does not accept nulls.

This method execute tasks on the main thread, and can cause stuttering or delay when the main thread is busy. Consider migrating to whenAllComplete where an executor can be specified to use a background thread.

public static @NonNull Task<List<Task<Object>>> whenAllComplete(@Nullable Collection<Task<Object>> tasks)

Returns a Task with a list of Tasks that completes successfully when all of the specified Tasks complete. This Task would always succeed even if any of the provided Tasks fail or canceled. Does not accept nulls.

This method execute tasks on the main thread, and can cause stuttering or delay when the main thread is busy. Consider migrating to whenAllComplete where an executor can be specified to use a background thread.

public static @NonNull Task<List<Task<Object>>> whenAllComplete(Executor executor, @Nullable Task[] tasks)

Returns a Task with a list of Tasks that completes successfully when all of the specified Tasks complete. This Task would always succeed even if any of the provided Tasks fail or canceled. Does not accept nulls.

public static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(@Nullable Task[] tasks)

Returns a Task with a list of Task results that completes successfully when all of the specified Tasks complete successfully. This Task would fail if any of the provided Tasks fail. Does not accept nulls.

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

This method execute tasks on the main thread, and can cause stuttering or delay when the main thread is busy. Consider migrating to whenAllSuccess where an executor can be specified to use a background thread.

public static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(@Nullable Collection<Task<Object>> tasks)

Returns a Task with a list of Task results that completes successfully when all of the specified Tasks complete successfully. This Task would fail if any of the provided Tasks fail. Does not accept nulls.

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

This method execute tasks on the main thread, and can cause stuttering or delay when the main thread is busy. Consider migrating to whenAllSuccess where an executor can be specified to use a background thread.

public static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(Executor executor, @Nullable Task[] tasks)

Returns a Task with a list of Task results that completes successfully when all of the specified Tasks complete successfully. This Task would fail if any of the provided Tasks fail. Does not accept nulls.

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

public static @NonNull Task<List<TResult>> <TResult> whenAllSuccess(
    Executor executor,
    @Nullable Collection<Task<Object>> tasks
)

Returns a Task with a list of Task results that completes successfully when all of the specified Tasks complete successfully. This Task would fail if any of the provided Tasks fail. Does not accept nulls.

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

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2024-10-31 UTC.

[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-10-31 UTC."],[[["The `Tasks` class provides utility methods for working with `Task` objects in Google Play services."],["It offers methods to await task completion, create completed tasks with results or exceptions, and manage multiple tasks."],["`Tasks` facilitates creating tasks from callables, but using `TaskCompletionSource` is now recommended for better executor management."],["Methods like `whenAll` and `whenAllSuccess` help handle collections of tasks, while `withTimeout` allows setting a time limit for task completion."],["Deprecated `call` methods should be replaced with `TaskCompletionSource` for improved control over task execution."]]],[]]


RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4