Example usage for android.support.v4.media MediaBrowserCompat getExtras

List of usage examples for android.support.v4.media MediaBrowserCompat getExtras

Introduction

In this page you can find the example usage for android.support.v4.media MediaBrowserCompat getExtras.

Prototype

public @Nullable Bundle getExtras() 

Source Link

Document

Gets any extras for the media service.

Usage

From source file:androidx.media.MediaBrowser2.java

/**
 * Get the library root. Result would be sent back asynchronously with the
 * {@link BrowserCallback#onGetLibraryRootDone(MediaBrowser2, Bundle, String, Bundle)}.
 *
 * @param extras extras for getting root
 * @see BrowserCallback#onGetLibraryRootDone(MediaBrowser2, Bundle, String, Bundle)
 *///from ww w .  j  av a 2 s .  c  o  m
public void getLibraryRoot(@Nullable final Bundle extras) {
    final MediaBrowserCompat browser = getBrowserCompat(extras);
    if (browser != null) {
        // Already connected with the given extras.
        getCallbackExecutor().execute(new Runnable() {
            @Override
            public void run() {
                getCallback().onGetLibraryRootDone(MediaBrowser2.this, extras, browser.getRoot(),
                        browser.getExtras());
            }
        });
    } else {
        MediaBrowserCompat newBrowser = new MediaBrowserCompat(getContext(),
                getSessionToken().getComponentName(), new GetLibraryRootCallback(extras), extras);
        newBrowser.connect();
        synchronized (mLock) {
            mBrowserCompats.put(extras, newBrowser);
        }
    }
}