ncapdevi / FragNav

An Android library for managing multiple stacks of fragments
1.5k stars 220 forks source link

How to Pop Specific Fragment? #159

Closed chnouman closed 5 years ago

chnouman commented 6 years ago

I have a scenario in which I have to pop the previous fragment and push new fragment I'm using slide left and slide right animation with my fragments when i try to do this

 @Override
    public void pushFragment(Fragment fragment) {
        if (mNavController != null) {
            if (mNavController.getCurrentFrag() instanceof AboutYouFragment){
                mNavController.popFragment();
            }
            mNavController.pushFragment(fragment);
        }
    }

it causes bad animation both at the same time left and right. What i want to do is first push the fragment and then pop the previous fragment.

chnouman commented 6 years ago

@ncapdevi

ncapdevi commented 5 years ago

It's managed as a stack, you can only ever pop the top fragment on a stack