MediaBrowserServiceCompat.Result


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 functions

Unit

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

Unit
sendError(extras: Bundle?)

Notify the caller of a failure.

Unit

Send an interim update to the caller.

Unit
sendResult(result: T?)

Send the result back to the caller.

Public functions

detach

Added in 1.1.0
fun detach(): Unit

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

sendError

Added in 1.1.0
fun sendError(extras: Bundle?): Unit

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

Parameters
extras: Bundle?

A bundle that contains extra data.

sendProgressUpdate

Added in 1.1.0
fun sendProgressUpdate(extras: Bundle?): Unit

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

Parameters
extras: Bundle?

A bundle that contains extra data.

sendResult

Added in 1.1.0
fun sendResult(result: T?): Unit

Send the result back to the caller.