I wanted to know when a Fragment has been pop from backstack.
I have my code as below
private void setupChildFragmentPopListener() {
getChildFragmentManager().addOnBackStackChangedListener(
new FragmentManager.OnBackStackChangedListener() {
@Override
public void onBackStackChanged() {
// Do whatever I want
}
});
}
However, this code got triggered both when add and pop fragment. How could I have a way to listen only to pop fragment? Or a way to filter out in the onBackStackChanged()
function if it is not pop?