MediaBrowserServiceCompat.Result


public class 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 or sendError to respond to the caller with the given results or errors. If those functions return without calling sendResult or sendError, they must instead call detach before returning, and then may call sendResult or sendError when they are done. If sendResult, sendError, or detach is called twice, an exception will be thrown.

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

Summary

Public methods

void

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

void

Notify the caller of a failure.

void

Send an interim update to the caller.

void
sendResult(@Nullable T result)

Send the result back to the caller.

Public methods

detach

Added in 1.1.0
public void detach()

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

sendError

Added in 1.1.0
public void sendError(@Nullable Bundle extras)

Notify the caller of a failure. This is supported only when it is used in onCustomAction.

Parameters
@Nullable Bundle extras

A bundle that contains extra data.

sendProgressUpdate

Added in 1.1.0
public void sendProgressUpdate(@Nullable Bundle extras)

Send an interim update to the caller. This method is supported only when it is used in onCustomAction.

Parameters
@Nullable Bundle extras

A bundle that contains extra data.

sendResult

Added in 1.1.0
public void sendResult(@Nullable T result)

Send the result back to the caller.