List of usage examples for android.support.v4.media MediaBrowserCompat unsubscribe
public void unsubscribe(@NonNull String parentId, @NonNull SubscriptionCallback callback)
From source file:androidx.media.MediaBrowser2.java
/** * Unsubscribe for changes to the children of the parent, which was previously subscribed with * {@link #subscribe(String, Bundle)}./*from w w w .ja v a2 s . co m*/ * <p> * This unsubscribes all previous subscription with the parent id, regardless of the extra * that was previously sent to the library service. * * @param parentId parent id */ public void unsubscribe(@NonNull String parentId) { if (parentId == null) { throw new IllegalArgumentException("parentId shouldn't be null"); } // Note: don't use MediaBrowserCompat#unsubscribe(String) here, to keep the subscription // callback for getChildren. synchronized (mLock) { List<SubscribeCallback> list = mSubscribeCallbacks.get(parentId); if (list == null) { return; } MediaBrowserCompat browser = getBrowserCompat(); for (int i = 0; i < list.size(); i++) { browser.unsubscribe(parentId, list.get(i)); } } }