ncapdevi / FragNav

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

How to Remove fragment from stack #202

Closed MrzAhmadi closed 5 years ago

MrzAhmadi commented 5 years ago

I want to have just one instance of a particular fraction in the stack. I do this as follows, but it does not work properly and the target fugue is not deleted.

`

            for(int i =0 ; i <mFragNavController.getStack(FragNavController.TAB1).size() ; i++){
                Object object = mFragNavController.getStack(FragNavController.TAB1).get(i);
                if (object instanceof MyFragment)
                    mFragNavController.getStack(FragNavController.TAB1).remove(i);
            }

`

MrzAhmadi commented 5 years ago

@ncapdevi

ncapdevi commented 5 years ago

That's not how stacks work https://en.wikipedia.org/wiki/Stack_(abstract_data_type) and that functionality it outside the scope of this library and will not be included.

hosseinaminii commented 5 years ago

@smrahmadi did you find a proper solution?