Stay organized with collections
Save and categorize content based on your preferences.
@Profile.ExperimentalUrlPrefetch
interface OutcomeReceiverCompat<T, E : Throwable?>
Callback interface intended for use when an asynchronous operation may result in a failure. This interface may be used in cases where an asynchronous API may complete either with a value or with a Throwable that indicates an error.
| Parameters |
<T> |
The type of the result that's being sent.
|
<E : Throwable?> |
The type of the Throwable that contains more information about the error. This interface serves the same purpose as android.os.OutcomeReceiver, but can be used on API versions before 31. TODO(b/380060342): To be removed once we release androidx.core.os.OutcomeReceiverCompat.
|
Summary
Public functions |
Unit |
Called when the asynchronous operation fails.
|
Unit |
Called when the asynchronous operation succeeds and delivers a result value.
|
Public functions
fun onError(error: E): Unit
Called when the asynchronous operation fails. The mode of failure is indicated by the Throwable passed as an argument to this method.
| Parameters |
error: E |
A subclass of Throwable with more details about the error that occurred.
|
fun onResult(result: T!): Unit
Called when the asynchronous operation succeeds and delivers a result value.
| Parameters |
result: T! |
The value delivered by the asynchronous operation.
|
Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-11-19 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 2025-11-19 UTC."],[],[]]