Example usage for android.app FragmentManager removeOnBackStackChangedListener

List of usage examples for android.app FragmentManager removeOnBackStackChangedListener

Introduction

In this page you can find the example usage for android.app FragmentManager removeOnBackStackChangedListener.

Prototype

public abstract void removeOnBackStackChangedListener(OnBackStackChangedListener listener);

Source Link

Document

Remove a listener that was previously added with #addOnBackStackChangedListener(OnBackStackChangedListener) .

Usage

From source file:com.android.tv.ui.TvOverlayManager.java

private void runAfterSideFragmentsAreClosed(final Runnable runnable) {
    final FragmentManager manager = mMainActivity.getFragmentManager();
    if (mSideFragmentManager.isSidePanelVisible()) {
        manager.addOnBackStackChangedListener(new OnBackStackChangedListener() {
            @Override/*from   ww  w.j  a v a 2 s .c  om*/
            public void onBackStackChanged() {
                if (manager.getBackStackEntryCount() == 0) {
                    manager.removeOnBackStackChangedListener(this);
                    runnable.run();
                }
            }
        });
    } else {
        runnable.run();
    }
}