Git Product home page Git Product logo

Comments (1)

ser-dev avatar ser-dev commented on August 24, 2024

Hello,
I'd like to thank you as well @drozdzynski for this great lib 🥇

But I think I'm facing a similar problem as the one reported in this issue.
I have a NavDrawer that handles several fragments. One of the fragments contains the StepperView with a few steps. It works great and looks awesome, but I face one problem: if the user leaves the current fragment and moves to another, and then comes back... the StepperView is not created from scratch. It looks like it saves some state and the initial steps appear collapsed.

Would you know how to reset the whole StepperView to the initial state when moving between fragments?

EDIT:
I found a way (not very beautiful though...) to accomplish the reset when moving to another fragment and coming back -> just removing the fragments which are set into each of the steps:

for(Fragment f:getActivity().getSupportFragmentManager().getFragments()){
            if(f!=null &&
                    f instanceof MyFragment1 || 
                    f instanceof MyFragment2
                getActivity().getSupportFragmentManager().beginTransaction().remove(f).commit();
        }

With that, the StepperView is created and the onCreateView is called for each for the MyFragmentX and they are visible again.

Another possibility that may work is to just restart the whole fragment by detaching and attaching it again:

YourFragmentClass fragment = (YourFragmentClass) 
getFragmentManager().findFragmentById(R.id.your_fragment_container_id)

getFragmentManager().beginTransaction()
                    .detach(fragment)
                    .attach(fragment)
                    .commit();

Second solution from: http://stackoverflow.com/questions/33461560/restart-fragment-class-when-back-button-press

from steppers.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.