Example usage for android.media.browse MediaBrowser getRoot

List of usage examples for android.media.browse MediaBrowser getRoot

Introduction

In this page you can find the example usage for android.media.browse MediaBrowser getRoot.

Prototype

public @NonNull String getRoot() 

Source Link

Document

Gets the root id.

Usage

From source file:com.orangesoft.jook.ui.tv.TvVerticalGridFragment.java

protected void setMediaId(String mediaId) {
    Log.d(TAG, "setMediaId: " + mediaId);
    if (TextUtils.equals(this.mediaId, mediaId))
        return;/*from   w  w w . j a  v  a  2 s  .com*/
    MediaBrowser mediaBrowser = mediaFragmentListener.getMediaBrowser();

    if (this.mediaId != null)
        mediaBrowser.unsubscribe(mediaId);
    if (null == mediaId)
        mediaId = mediaBrowser.getRoot();
    this.mediaId = mediaId;
    mediaBrowser.subscribe(this.mediaId, subscriptionCallback);
}

From source file:com.example.android.spotifystreamer.ui.tv.TvVerticalGridFragment.java

protected void setMediaId(String mediaId) {
    LogHelper.d(TAG, "setMediaId: ", mediaId);
    if (TextUtils.equals(mMediaId, mediaId)) {
        return;//from  w  ww. ja  va 2s . c  o  m
    }
    MediaBrowser mediaBrowser = mMediaFragmentListener.getMediaBrowser();

    // First, unsubscribe from old mediaId:
    if (mMediaId != null) {
        mediaBrowser.unsubscribe(mMediaId);
    }
    if (mediaId == null) {
        mediaId = mediaBrowser.getRoot();
    }
    mMediaId = mediaId;
    mediaBrowser.subscribe(mMediaId, mSubscriptionCallback);
}