public class

MediaBrowserServiceCompat.Result<T>

extends java.lang.Object

 java.lang.Object

↳androidx.media3.session.legacy.MediaBrowserServiceCompat.Result<T>

Overview

Completion handler for asynchronous callback methods in MediaBrowserServiceCompat.

Each of the methods that takes one of these to send the result must call either MediaBrowserServiceCompat.Result.sendResult(T) or MediaBrowserServiceCompat.Result.sendError(Bundle) to respond to the caller with the given results or errors. If those functions return without calling MediaBrowserServiceCompat.Result.sendResult(T) or MediaBrowserServiceCompat.Result.sendError(Bundle), they must instead call MediaBrowserServiceCompat.Result.detach() before returning, and then may call MediaBrowserServiceCompat.Result.sendResult(T) or MediaBrowserServiceCompat.Result.sendError(Bundle) when they are done. If MediaBrowserServiceCompat.Result.sendResult(T), MediaBrowserServiceCompat.Result.sendError(Bundle), or MediaBrowserServiceCompat.Result.detach() is called twice, an exception will be thrown.

Those functions might also want to call MediaBrowserServiceCompat.Result.sendProgressUpdate(Bundle) to send interim updates to the caller. If it is called after calling MediaBrowserServiceCompat.Result.sendResult(T) or MediaBrowserServiceCompat.Result.sendError(Bundle), an exception will be thrown.

Summary

Methods
public voiddetach()

Detach this message from the current thread and allow the MediaBrowserServiceCompat.Result.sendResult(T) call to happen later.

public voidsendError(Bundle extras)

Notify the caller of a failure.

public voidsendProgressUpdate(Bundle extras)

Send an interim update to the caller.

public voidsendResult(java.lang.Object result)

Send the result back to the caller.

from java.lang.Objectclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Methods

public void sendResult(java.lang.Object result)

Send the result back to the caller.

public void sendProgressUpdate(Bundle extras)

Send an interim update to the caller. This method is supported only when it is used in MediaBrowserServiceCompat.onCustomAction(String, Bundle, MediaBrowserServiceCompat.Result).

Parameters:

extras: A bundle that contains extra data.

public void sendError(Bundle extras)

Notify the caller of a failure. This is supported only when it is used in MediaBrowserServiceCompat.onCustomAction(String, Bundle, MediaBrowserServiceCompat.Result).

Parameters:

extras: A bundle that contains extra data.

public void detach()

Detach this message from the current thread and allow the MediaBrowserServiceCompat.Result.sendResult(T) call to happen later.