Save the date! Android Dev Summit is coming to Mountain View, CA on November 7-8, 2018.
Android 0.0.0 Developer Preview
belongs to Maven artifact androidx.media:media:1.0.0-rc01

MediaBrowserServiceCompat.Result

public static class MediaBrowserServiceCompat.Result
extends Object

java.lang.Object
   ↳ androidx.media.MediaBrowserServiceCompat.Result<T>


Completion handler for asynchronous callback methods in MediaBrowserServiceCompat.

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

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

Summary

Public methods

void detach()

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

void sendError(Bundle extras)

Notify the caller of a failure.

void sendProgressUpdate(Bundle extras)

Send an interim update to the caller.

void sendResult(T result)

Send the result back to the caller.

Inherited methods

Public methods

detach

public void detach ()

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

sendError

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 Bundle: A bundle that contains extra data.

sendProgressUpdate

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 Bundle: A bundle that contains extra data.

sendResult

public void sendResult (T result)

Send the result back to the caller.

Parameters
result T