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

MediaBrowser.BrowserCallback

public static class MediaBrowser.BrowserCallback
extends MediaController.ControllerCallback

java.lang.Object
   ↳ androidx.media2.session.MediaController.ControllerCallback
     ↳ androidx.media2.session.MediaBrowser.BrowserCallback


Callback to listen events from MediaLibraryService.

Summary

Public constructors

MediaBrowser.BrowserCallback()

Public methods

void onChildrenChanged(MediaBrowser browser, String parentId, int itemCount, MediaLibraryService.LibraryParams params)

Called when there's change in the parent's children after you've subscribed to the parent with MediaBrowser.subscribe(String, MediaLibraryService.LibraryParams).

void onSearchResultChanged(MediaBrowser browser, String query, int itemCount, MediaLibraryService.LibraryParams params)

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

Inherited methods

Public constructors

MediaBrowser.BrowserCallback

public MediaBrowser.BrowserCallback ()

Public methods

onChildrenChanged

public void onChildrenChanged (MediaBrowser browser, 
                String parentId, 
                int itemCount, 
                MediaLibraryService.LibraryParams params)

Called when there's change in the parent's children after you've subscribed to the parent with MediaBrowser.subscribe(String, MediaLibraryService.LibraryParams).

This API is called when the library service called MediaLibraryService.MediaLibrarySession.notifyChildrenChanged(MediaSession.ControllerInfo, String, int, MediaLibraryService.LibraryParams) for the parent.

Parameters
browser MediaBrowser: the browser for this event

parentId String: non-empty parent id that you've specified with MediaBrowser.subscribe(String, LibraryParams)

itemCount int: number of children

params MediaLibraryService.LibraryParams: library params from the library service. Can be differ from params that you've specified with MediaBrowser.subscribe(String, LibraryParams).

onSearchResultChanged

public void onSearchResultChanged (MediaBrowser browser, 
                String query, 
                int itemCount, 
                MediaLibraryService.LibraryParams params)

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

Parameters
browser MediaBrowser: the browser for this event

query String: non-empty search query that you've specified with MediaBrowser.search(String, LibraryParams)

itemCount int: The item count for the search result

params MediaLibraryService.LibraryParams: library params from the library service. Can be differ from params that you've specified with MediaBrowser.search(String, LibraryParams).