WebViewOutcomeReceiver


public interface WebViewOutcomeReceiver<T, E extends Throwable>

Known direct subclasses
OutcomeReceiverCompat

This interface is deprecated.

The OutcomeReceiverCompat name clashes with the same class in androidx.core, so the webkit library version was renamed to avoid confusion.


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.

This interface serves the same purpose as android.os.OutcomeReceiver, but can be used on API versions before 31. It is also identical to androidx.core.os.OutcomeReceiverCompat, but the androidx.webkit library maintains a separate copy to be able to remain at compileSdk = 33, which would not be possible with a dependency on androidx.core:core:1.16.0, which uses compileSdk = 35.

Parameters
<T>

The type of the result that's being sent.

<E extends Throwable>

The type of the Throwable that contains more information about the error.

Summary

Public methods

default void
onError(@NonNull E error)

Called when the asynchronous operation fails.

abstract void
onResult(T result)

Called when the asynchronous operation succeeds and delivers a result value.

Public methods

onError

default void onError(@NonNull E error)

Called when the asynchronous operation fails. The mode of failure is indicated by the Throwable passed as an argument to this method.

Parameters
@NonNull E error

A subclass of Throwable with more details about the error that occurred.

onResult

abstract void onResult(T result)

Called when the asynchronous operation succeeds and delivers a result value.

Parameters
T result

The value delivered by the asynchronous operation.