Android Dev Summit, October 23-24: two days of technical content, directly from the Android team. Sign-up for livestream updates.

Result

open class Result<T : Any!>
kotlin.Any
   ↳ androidx.media.MediaBrowserServiceCompat.Result

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

open Unit

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

open Unit
sendError(extras: Bundle!)

Notify the caller of a failure.

open Unit

Send an interim update to the caller.

open Unit
sendResult(result: T)

Send the result back to the caller.

Public methods

detach

open fun detach(): Unit

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

sendError

open 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

open 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

open fun sendResult(result: T): Unit

Send the result back to the caller.