Android SDK Version
- Mutable
- CollectionMapper
- AppCall
- CustomTab
- CustomTabUtils
- DialogFeature
- DialogPresenter
- FacebookDialogBase
- FacebookDialogFragment
- GamingAction
- FacebookWebFallbackDialog
- FragmentWrapper
- InstagramCustomTab
- PlatformServiceClient
- WebDialog
- AnalyticsEvents
- AttributionIdentifiers
- BoltsMeasurementEventListener
- BundleJSONConverter
- CallbackManagerImpl
- FacebookInitProvider
- FacebookRequestErrorClassification
- FacebookSignatureValidator
- FeatureManager
- FetchedAppGateKeepersManager
- FetchedAppSettings
- FetchedAppSettingsManager
- FileLruCache
- ImageDownloader
- ImageRequest
- ImageResponse
- ImageResponseCache
- InstallReferrerUtil
- InternalSettings
- LockOnGetVariable
- Logger
- NativeAppCallAttachmentStore
- NativeProtocol
- ServerProtocol
- SmartLoginOption
- UrlRedirectCache
- Utility
- Validate
- WorkQueue
- MessageDialog
- SendButton
- ShareButton
- ShareButtonBase
- GameRequestDialog
- ShareDialog
- MessageDialogFeature
- VideoUploader
- GameRequestValidation
- CameraEffectFeature
- CameraEffectJSONUtility
- LegacyNativeDialogParameters
- NativeDialogParameters
- ResultProcessor
- ShareConstants
- ShareContentValidation
- ShareDialogFeature
- ShareFeedContent
- ShareInternalUtility
- ShareStoryFeature
- WebDialogParameters
- ShareApi
- ShareBuilder
- Sharer
- Share
- ShareToMessengerParamsBuilder
- Messenger
- MessengerThreadParams
- MessengerUtils
- ShareToMessengerParams
- FacebookAppLinkResolver
- AppLinkData
- AppLinks
- AggregateException
- AppLink
- AppLinkResolver
- AppLinks
- CancellationToken
- CancellationTokenRegistration
- CancellationTokenSource
- Continuation
- ExecutorException
- Task
- TaskCompletionSource
- UnobservedTaskException
- AccessTokenTracker
- AuthenticationTokenTracker
- CustomTabActivity
- CustomTabMainActivity
- FacebookActivity
- FacebookAuthorizationException
- FacebookButtonBase
- FacebookCallback
- FacebookDialog
- FacebookDialogException
- LoginStatusCallback
- WebDialog
- AccessToken
- AccessTokenManager
- AccessTokenSource
- AuthenticationToken
- AuthenticationTokenCache
- AuthenticationTokenClaims
- AuthenticationTokenHeader
- AuthenticationTokenManager
- CallbackManager
- CurrentAccessTokenExpirationBroadcastReceiver
- FacebookBroadcastReceiver
- FacebookContentProvider
- FacebookException
- FacebookGraphResponseException
- FacebookOperationCanceledException
- FacebookRequestError
- FacebookSdk
- FacebookSdkNotInitializedException
- FacebookServiceException
- GraphRequest
- GraphRequestAsyncTask
- GraphRequestBatch
- GraphResponse
- HttpMethod
- LoggingBehavior
- Profile
- ProfileCache
- ProfileManager
- ProfileTracker
- ProgressNoopOutputStream
- ProgressOutputStream
- RequestProgress
- Common
- DeviceRequestsHelper
- EndToEndDumper
- CodeChallengeMethod
- CustomTabLoginMethodHandler
- CustomTabPrefetchHelper
- DeviceAuthDialog
- DeviceAuthMethodHandler
- GetTokenLoginMethodHandler
- KatanaProxyLoginMethodHandler
- LoginBehavior
- LoginClient
- LoginConfiguration
- LoginFragment
- LoginManager
- LoginMethodHandler
- LoginResult
- NativeAppLoginMethodHandler
- NonceUtil
- WebLoginMethodHandler
- WebViewLoginMethodHandler
- DefaultAudience
- LoginTargetApp
- DeviceLoginManager
- Login
- AppGroupCreationContent
- CameraEffectArguments
- CameraEffectTextures
- GameRequestContent
- ShareCameraEffectContent
- ShareContent
- ShareHashtag
- ShareLinkContent
- ShareMedia
- ShareMediaContent
- ShareMessengerActionButton
- ShareMessengerURLActionButton
- ShareModel
- ShareModelBuilder
- SharePhoto
- SharePhotoContent
- ShareStoryContent
- ShareVideo
- ShareVideoContent
- AccessTokenAppIdPair
- AppEvent
- AppEventsConstants
- AppEventsLogger
- AppEventsManager
- FlushResult
- InternalAppEventsLogger
- UserDataStore
- MetadataIndexer
- MetadataRule
- SettingsAPIFields
- AppEventsCAPIManager
- CustomEventField
- AppEventType
- AppEventUserAndAppDataField
- ConversionsAPISection
- ConversionsAPICustomEventField
- ConversionsAPIUserAndAppDataField
- ConversionsAPIEventName
- OtherEventConstants
- AppEventsConversionsAPITransformer
- AppEventsConversionsAPITransformerWebRequests
- CodelessLoggingEventListener
- CodelessManager
- RCTCodelessLoggingEventListener
- ViewIndexer
- Constants
- EventBinding
- ParameterComponent
- PathComponent
- SensitiveUserDataUtils
- UnityReflection
- ViewHierarchy
- EventDeactivationManager
- InAppPurchaseActivityLifecycleTracker
- InAppPurchaseAutoLogger
- InAppPurchaseBillingClientWrapper
- InAppPurchaseEventManager
- InAppPurchaseLoggerManager
- InAppPurchaseManager
- InAppPurchaseSkuDetailsWrapper
- InAppPurchaseUtils
- IntegrityManager
- ActivityLifecycleTracker
- AppEventUtility
- AppEventsLoggerUtility
- AutomaticAnalyticsLogger
- Constants
- FileDownloadTask
- ViewHierarchyConstants
- MTensor
- Model
- ModelManager
- Utils
- OnDeviceProcessingManager
- RemoteServiceWrapper
- RestrictiveDataManager
- SuggestedEventsManager
- ViewOnClickListener
- Core
- GateKeeper
- GateKeeperRuntimeCache
- ExceptionAnalyzer
- InstrumentData
- InstrumentManager
- InstrumentUtility
- ANRDetector
- ANRHandler
- CrashHandler
- AutoHandleExceptions
- CrashShieldHandler
- NoAutoExceptionHandling
- ErrorReportData
- ErrorReportHandler
- ThreadCheckHandler
- Excuse
- ExcusesForDesignViolations
- CertificateUtil
- OidcSecurityUtil
- DeviceLoginButton
- LoginButton
- ProfilePictureView
- ToolTipPopup
- All
public class Task.Companion
Field Summary
Modifier and Type | Field | Description |
---|---|---|
public final ExecutorService | BACKGROUND_EXECUTOR | |
public final Executor | UI_THREAD_EXECUTOR | |
public final static Task.Companion | INSTANCE |
Method Summary
Modifier and Type | Method | Description |
---|---|---|
final Task.UnobservedExceptionHandler | getUnobservedExceptionHandler() | Returns the handler invoked when a task has an unobserved exception or null . |
final Unit | setUnobservedExceptionHandler(Task.UnobservedExceptionHandler eh) | Set the handler invoked when a task has an unobserved exception. |
final <TResult extends Any> Task<TResult> | forResult(TResult value) | Creates a completed task with the given value. |
final <TResult extends Any> Task<TResult> | forError(Exception error) | Creates a faulted task with the given error. |
final <TResult extends Any> Task<TResult> | cancelled() | Creates a cancelled task. |
final Task<Void> | delay(Long delay) | Creates a task that completes after a time delay. |
final Task<Void> | delay(Long delay, CancellationToken cancellationToken) | Creates a task that completes after a time delay. |
final <TResult extends Any> Task<TResult> | callInBackground(Callable<TResult> callable) | Invokes the callable on a background thread, returning a Task to represent the operation. |
final <TResult extends Any> Task<TResult> | callInBackground(Callable<TResult> callable, CancellationToken ct) | Invokes the callable on a background thread, returning a Task to represent the operation. |
final <TResult extends Any> Task<TResult> | call(Callable<TResult> callable, Executor executor) | Invokes the callable using the given executor, returning a Task to represent the operation. |
final <TResult extends Any> Task<TResult> | call(Callable<TResult> callable, Executor executor, CancellationToken ct) | Invokes the callable using the given executor, returning a Task to represent the operation. |
final <TResult extends Any> Task<TResult> | call(Callable<TResult> callable) | Invokes the callable on the current thread, producing a Task. |
final <TResult extends Any> Task<TResult> | call(Callable<TResult> callable, CancellationToken ct) | Invokes the callable on the current thread, producing a Task. |
final <TResult extends Any> Task<Task<TResult>> | whenAnyResult(Collection<Task<TResult>> tasks) | Creates a task that will complete when any of the supplied tasks have completed. |
final Task<Task<?>> | whenAny(Collection<Task<?>> tasks) | Creates a task that will complete when any of the supplied tasks have completed. |
final <TResult extends Any> Task<List<TResult>> | whenAllResult(Collection<Task<TResult>> tasks) | Creates a task that completes when all of the provided tasks are complete. |
final Task<Void> | whenAll(Collection<Task<?>> tasks) | Creates a task that completes when all of the provided tasks are complete. |
final ExecutorService | getBACKGROUND_EXECUTOR() | An java.util.concurrent.Executor that executes tasks in parallel. |
final Executor | getUI_THREAD_EXECUTOR() | An java.util.concurrent.Executor that executes tasks on the UI thread. |
Method Detail
getUnobservedExceptionHandler
final Task.UnobservedExceptionHandlergetUnobservedExceptionHandler()
Returns the handler invoked when a task has an unobserved exception or
null
.setUnobservedExceptionHandler
final UnitsetUnobservedExceptionHandler(Task.UnobservedExceptionHandler eh)
Set the handler invoked when a task has an unobserved exception.
Parameters:
eh
- the object to use as an unobserved exception handler.forResult
final <TResult extends Any> Task<TResult> forResult(TResult value)
Creates a completed task with the given value.
forError
final <TResult extends Any> Task<TResult> forError(Exception error)
Creates a faulted task with the given error.
delay
final Task<Void> delay(Long delay)
Creates a task that completes after a time delay.
Parameters:
delay
- The number of milliseconds to wait before completing the returned task.delay
final Task<Void> delay(Long delay, CancellationToken cancellationToken)
Creates a task that completes after a time delay.
Parameters:
delay
- The number of milliseconds to wait before completing the returned task.cancellationToken
- The optional cancellation token that will be checked prior to completing the returned task.callInBackground
final <TResult extends Any> Task<TResult> callInBackground(Callable<TResult> callable)
Invokes the callable on a background thread, returning a Task to represent the operation.
If you want to cancel the resulting Task throw a Exception from the callable.
callInBackground
final <TResult extends Any> Task<TResult> callInBackground(Callable<TResult> callable, CancellationToken ct)
Invokes the callable on a background thread, returning a Task to represent the operation.
call
final <TResult extends Any> Task<TResult> call(Callable<TResult> callable, Executor executor)
Invokes the callable using the given executor, returning a Task to represent the operation.
If you want to cancel the resulting Task throw a Exception from the callable.
call
final <TResult extends Any> Task<TResult> call(Callable<TResult> callable, Executor executor, CancellationToken ct)
Invokes the callable using the given executor, returning a Task to represent the operation.
call
final <TResult extends Any> Task<TResult> call(Callable<TResult> callable)
Invokes the callable on the current thread, producing a Task.
If you want to cancel the resulting Task throw a Exception from the callable.
call
final <TResult extends Any> Task<TResult> call(Callable<TResult> callable, CancellationToken ct)
Invokes the callable on the current thread, producing a Task.
whenAnyResult
final <TResult extends Any> Task<Task<TResult>> whenAnyResult(Collection<Task<TResult>> tasks)
Creates a task that will complete when any of the supplied tasks have completed.
The returned task will complete when any of the supplied tasks has completed. The returned task will always end in the completed state with its result set to the first task to complete. This is true even if the first task to complete ended in the canceled or faulted state.
Parameters:
tasks
- The tasks to wait on for completion.whenAny
final Task<Task<?>> whenAny(Collection<Task<?>> tasks)
Creates a task that will complete when any of the supplied tasks have completed.
The returned task will complete when any of the supplied tasks has completed. The returned task will always end in the completed state with its result set to the first task to complete. This is true even if the first task to complete ended in the canceled or faulted state.
Parameters:
tasks
- The tasks to wait on for completion.whenAllResult
final <TResult extends Any> Task<List<TResult>> whenAllResult(Collection<Task<TResult>> tasks)
Creates a task that completes when all of the provided tasks are complete.
If any of the supplied tasks completes in a faulted state, the returned task will also complete in a faulted state, where its exception will resolve to that Exception if a single task fails or an AggregateException of all the Exceptions if multiple tasks fail.
If none of the supplied tasks faulted but at least one of them was cancelled, the returned task will end as cancelled.
If none of the tasks faulted and none of the tasks were cancelled, the resulting task will end completed. The result of the returned task will be set to a list containing all of the results of the supplied tasks in the same order as they were provided (e.g. if the input tasks collection contained t1, t2, t3, the output task's result will return an
List<TResult>
where list.get(0) == t1.getResult(), list.get(1) == t2.getResult(), and list.get(2) == t3.getResult()
).If the supplied collection contains no tasks, the returned task will immediately transition to a completed state before it's returned to the caller. The returned
List<TResult>
will contain 0 elements.Parameters:
tasks
- The tasks that the return value will wait for before completing.whenAll
final Task<Void> whenAll(Collection<Task<?>> tasks)
Creates a task that completes when all of the provided tasks are complete.
If any of the supplied tasks completes in a faulted state, the returned task will also complete in a faulted state, where its exception will resolve to that [ ] if a single task fails or an AggregateException of all the [ ]s if multiple tasks fail.
If none of the supplied tasks faulted but at least one of them was cancelled, the returned task will end as cancelled.
If none of the tasks faulted and none of the tasks were canceled, the resulting task will end in the completed state.
If the supplied collection contains no tasks, the returned task will immediately transition to a completed state before it's returned to the caller.
Parameters:
tasks
- The tasks that the return value will wait for before completing.getBACKGROUND_EXECUTOR
final ExecutorServicegetBACKGROUND_EXECUTOR()
An java.util.concurrent.Executor that executes tasks in parallel.
getUI_THREAD_EXECUTOR
final ExecutorgetUI_THREAD_EXECUTOR()
An java.util.concurrent.Executor that executes tasks on the UI thread.