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

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

Introduction

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

Prototype

public void subscribe(@NonNull String parentId, @NonNull SubscriptionCallback callback) 

Source Link

Document

Queries for information about the media items that are contained within the specified id and subscribes to receive updates when they change.

Usage

From source file:com.bayapps.android.robophish.ui.tv.TvVerticalGridFragment.java

protected void setMediaId(String mediaId) {
    LogHelper.d(TAG, "setMediaId: ", mediaId);
    if (TextUtils.equals(mMediaId, mediaId)) {
        return;/*from w  w  w.ja v  a  2  s  .  c o  m*/
    }
    MediaBrowserCompat 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);
}