MediaBrowser2.BrowserCallback

public static class MediaBrowser2.BrowserCallback
extends MediaController2.ControllerCallback

java.lang.Object
   ↳ androidx.media2.MediaController2.ControllerCallback
     ↳ androidx.media2.MediaBrowser2.BrowserCallback


Callback to listen events from MediaLibraryService2.

Summary

Public constructors

MediaBrowser2.BrowserCallback()

Public methods

void onChildrenChanged(MediaBrowser2 browser, String parentId, int itemCount, Bundle extras)

Called when there's change in the parent's children.

void onGetChildrenDone(MediaBrowser2 browser, String parentId, int page, int pageSize, List<MediaItem2> result, Bundle extras)

Called when the list of items has been returned by the library service for the previous MediaBrowser2.getChildren(String, int, int, Bundle).

void onGetItemDone(MediaBrowser2 browser, String mediaId, MediaItem2 result)

Called when the item has been returned by the library service for the previous MediaBrowser2.getItem(String) call.

void onGetLibraryRootDone(MediaBrowser2 browser, Bundle rootHints, String rootMediaId, Bundle rootExtra)

Called with the result of MediaBrowser2.getLibraryRoot(Bundle).

void onGetSearchResultDone(MediaBrowser2 browser, String query, int page, int pageSize, List<MediaItem2> result, Bundle extras)

Called when the search result has been returned by the library service for the previous MediaBrowser2.getSearchResult(String, int, int, Bundle).

void onSearchResultChanged(MediaBrowser2 browser, String query, int itemCount, Bundle extras)

Called when there's change in the search result requested by the previous MediaBrowser2.search(String, Bundle).

Inherited methods

Public constructors

MediaBrowser2.BrowserCallback

public MediaBrowser2.BrowserCallback ()

Public methods

onChildrenChanged

public void onChildrenChanged (MediaBrowser2 browser, 
                String parentId, 
                int itemCount, 
                Bundle extras)

Called when there's change in the parent's children.

This API is called when the library service called MediaLibraryService2.MediaLibrarySession.notifyChildrenChanged(ControllerInfo, String, int, Bundle) or MediaLibraryService2.MediaLibrarySession.notifyChildrenChanged(String, int, Bundle) for the parent.

Parameters
browser MediaBrowser2: the browser for this event

parentId String: parent id that you've specified with MediaBrowser2.subscribe(String, Bundle)

itemCount int: number of children

extras Bundle: extra bundle from the library service. Can be differ from extras that you've specified with MediaBrowser2.subscribe(String, Bundle).

onGetChildrenDone

public void onGetChildrenDone (MediaBrowser2 browser, 
                String parentId, 
                int page, 
                int pageSize, 
                List<MediaItem2> result, 
                Bundle extras)

Called when the list of items has been returned by the library service for the previous MediaBrowser2.getChildren(String, int, int, Bundle).

Parameters
browser MediaBrowser2: the browser for this event

parentId String: parent id

page int: page number that you've specified with MediaBrowser2.getChildren(String, int, int, Bundle)

pageSize int: page size that you've specified with MediaBrowser2.getChildren(String, int, int, Bundle)

result List: result. Can be null

extras Bundle: extra bundle from the library service

onGetItemDone

public void onGetItemDone (MediaBrowser2 browser, 
                String mediaId, 
                MediaItem2 result)

Called when the item has been returned by the library service for the previous MediaBrowser2.getItem(String) call.

Result can be null if there had been error.

Parameters
browser MediaBrowser2: the browser for this event

mediaId String: media id

result MediaItem2: result. Can be null

onGetLibraryRootDone

public void onGetLibraryRootDone (MediaBrowser2 browser, 
                Bundle rootHints, 
                String rootMediaId, 
                Bundle rootExtra)

Called with the result of MediaBrowser2.getLibraryRoot(Bundle).

rootMediaId and rootExtra can be null if the library root isn't available.

Parameters
browser MediaBrowser2: the browser for this event

rootHints Bundle: rootHints that you previously requested.

rootMediaId String: media id of the library root. Can be null

rootExtra Bundle: extra of the library root. Can be null

onGetSearchResultDone

public void onGetSearchResultDone (MediaBrowser2 browser, 
                String query, 
                int page, 
                int pageSize, 
                List<MediaItem2> result, 
                Bundle extras)

Called when the search result has been returned by the library service for the previous MediaBrowser2.getSearchResult(String, int, int, Bundle).

Result can be null if there had been error.

Parameters
browser MediaBrowser2: the browser for this event

query String: search query that you've specified with MediaBrowser2.getSearchResult(String, int, int, Bundle)

page int: page number that you've specified with MediaBrowser2.getSearchResult(String, int, int, Bundle)

pageSize int: page size that you've specified with MediaBrowser2.getSearchResult(String, int, int, Bundle)

result List: result. Can be null.

extras Bundle: extra bundle from the library service

onSearchResultChanged

public void onSearchResultChanged (MediaBrowser2 browser, 
                String query, 
                int itemCount, 
                Bundle extras)

Called when there's change in the search result requested by the previous MediaBrowser2.search(String, Bundle).

Parameters
browser MediaBrowser2: the browser for this event

query String: search query that you've specified with MediaBrowser2.search(String, Bundle)

itemCount int: The item count for the search result

extras Bundle: extra bundle from the library service