# MediaBrowserServiceCompat.Result

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  
belongs to Maven artifact com.android.support:support-media-compat:28.0.0-alpha1  
Summary:[Methods](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.Result#pubmethods)\|[Inherited Methods](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.Result#inhmethods)\|[\[Expand All\]](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.Result#)  

# MediaBrowserServiceCompat.Result

| This package is part of the Android[support library](https://developer.android.com/topic/libraries/support-library)which is no longer maintained. The support library has been superseded by[AndroidX](https://developer.android.com/jetpack/androidx)which is part of[Jetpack](https://developer.android.com/jetpack). We recommend using the AndroidX libraries in all new projects. You should also consider[migrating](https://developer.android.com/jetpack/androidx/migrate)existing projects to AndroidX. To find the AndroidX class that maps to this deprecated class, see the AndroidX support library[class mappings](https://developer.android.com/jetpack/androidx/migrate/class-mappings).

`
public
static


class
MediaBrowserServiceCompat.Result
`  
`

extends Object


``


`

|---|----------------------------------------------------------------|
| java.lang.Object                                                  ||
| ↳ | android.support.v4.media.MediaBrowserServiceCompat.Result\<T\> |

<br />

*** ** * ** ***

Completion handler for asynchronous callback methods in[MediaBrowserServiceCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat).

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

Those functions might also want to call[sendProgressUpdate(Bundle)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendProgressUpdate(android.os.Bundle))to send interim updates to the caller. If it is called after calling[sendResult(T)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendResult(T))or[sendError(Bundle)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendError(android.os.Bundle)), an exception will be thrown.

<br />

**See also:**

- [onLoadChildren(String, MediaBrowserServiceCompat.Result>)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onLoadChildren(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>))
- [onLoadItem(String, MediaBrowserServiceCompat.Result)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onLoadItem(java.lang.String, android.support.v4.media.MediaBrowserServiceCompat.Result<android.support.v4.media.MediaBrowserCompat.MediaItem>))
- [onSearch(String, Bundle, MediaBrowserServiceCompat.Result>)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onSearch(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<java.util.List<android.support.v4.media.MediaBrowserCompat.MediaItem>>))
- [onCustomAction(String, Bundle, MediaBrowserServiceCompat.Result)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onCustomAction(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<android.os.Bundle>))

## Summary

|                                                                                                                                                                  ### Public methods                                                                                                                                                                  ||
|---------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ` void` | ` `[detach](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#detach())`() ` Detach this message from the current thread and allow the[sendResult(T)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendResult(T))call to happen later. |
| ` void` | ` `[sendError](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendError(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` extras) ` Notify the caller of a failure.                                                                        |
| ` void` | ` `[sendProgressUpdate](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendProgressUpdate(android.os.Bundle))`(`[Bundle](https://developer.android.com/reference/android/os/Bundle.html)` extras) ` Send an interim update to the caller.                                                |
| ` void` | ` `[sendResult](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendResult(T))`(T result) ` Send the result back to the caller.                                                                                                                                                           |

| ### Inherited methods |
|-----------------------|---|
| [![](https://developer.android.com/static/assets/images/styles/disclosure_down.png)](https://developer.android.com/reference/android/support/v4-media/MediaBrowserServiceCompat.Result#)From class` java.lang.Object ` |-------------------|-------------------------------| | ` Object`         | ` clone() `                   | | ` boolean`        | ` equals(Object arg0) `       | | ` void`           | ` finalize() `                | | ` final Class<?>` | ` getClass() `                | | ` int`            | ` hashCode() `                | | ` final void`     | ` notify() `                  | | ` final void`     | ` notifyAll() `               | | ` String`         | ` toString() `                | | ` final void`     | ` wait(long arg0, int arg1) ` | | ` final void`     | ` wait(long arg0) `           | | ` final void`     | ` wait() `                    | ||

## Public methods

### detach

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void detach ()
```

Detach this message from the current thread and allow the[sendResult(T)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result#sendResult(T))call to happen later.

<br />

### sendError

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void sendError (Bundle extras)
```

Notify the caller of a failure. This is supported only when it is used in[onCustomAction(String, Bundle, MediaBrowserServiceCompat.Result)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onCustomAction(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<android.os.Bundle>)).

<br />

|                          Parameters                           ||
|----------|-----------------------------------------------------|
| `extras` | `Bundle`: A bundle that contains extra data. <br /> |

### sendProgressUpdate

added in[version 25.4.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void sendProgressUpdate (Bundle extras)
```

Send an interim update to the caller. This method is supported only when it is used in[onCustomAction(String, Bundle, MediaBrowserServiceCompat.Result)](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat#onCustomAction(java.lang.String, android.os.Bundle, android.support.v4.media.MediaBrowserServiceCompat.Result<android.os.Bundle>)).

<br />

|                          Parameters                           ||
|----------|-----------------------------------------------------|
| `extras` | `Bundle`: A bundle that contains extra data. <br /> |

### sendResult

added in[version 24.1.0](https://developer.android.com/topic/libraries/support-library/revisions)  

```
void sendResult (T result)
```

Send the result back to the caller.

<br />

|      Parameters      ||
|----------|------------|
| `result` | `T` <br /> |

-

  ## Classes

  - [AudioAttributesCompat](https://developer.android.com/reference/android/support/v4/media/AudioAttributesCompat)
  - [AudioAttributesCompat.Builder](https://developer.android.com/reference/android/support/v4/media/AudioAttributesCompat.Builder)
  - [MediaBrowserCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat)
  - [MediaBrowserCompat.ConnectionCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ConnectionCallback)
  - [MediaBrowserCompat.CustomActionCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.CustomActionCallback)
  - [MediaBrowserCompat.ItemCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.ItemCallback)
  - [MediaBrowserCompat.MediaItem](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.MediaItem)
  - [MediaBrowserCompat.SearchCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SearchCallback)
  - [MediaBrowserCompat.SubscriptionCallback](https://developer.android.com/reference/android/support/v4/media/MediaBrowserCompat.SubscriptionCallback)
  - [MediaBrowserServiceCompat](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat)
  - [MediaBrowserServiceCompat.BrowserRoot](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.BrowserRoot)
  - [MediaBrowserServiceCompat.Result](https://developer.android.com/reference/android/support/v4/media/MediaBrowserServiceCompat.Result)
  - [MediaDescriptionCompat](https://developer.android.com/reference/android/support/v4/media/MediaDescriptionCompat)
  - [MediaDescriptionCompat.Builder](https://developer.android.com/reference/android/support/v4/media/MediaDescriptionCompat.Builder)
  - [MediaMetadataCompat](https://developer.android.com/reference/android/support/v4/media/MediaMetadataCompat)
  - [MediaMetadataCompat.Builder](https://developer.android.com/reference/android/support/v4/media/MediaMetadataCompat.Builder)
  - [RatingCompat](https://developer.android.com/reference/android/support/v4/media/RatingCompat)
  - [VolumeProviderCompat](https://developer.android.com/reference/android/support/v4/media/VolumeProviderCompat)
  - [VolumeProviderCompat.Callback](https://developer.android.com/reference/android/support/v4/media/VolumeProviderCompat.Callback)