2021-02-24 10:38 AM
Hi team,
I'm designing a multiple screens template in my application. I'm using a slider and a toggle button in one of my screen, I kept the slider invisible, and I linked to the toggle button.
when I change the state of the toggle button the slider has to appear and vice versa. now I'm changing the toggle button state (let's say ON) so now-slider will appear, after that I'm keeping the slider state halfway.
Now when I transitioned to another screen from this screen and coming back, at that time toggle button is in the OFF state and the slider is invisible (which is a default state) which shouldn't happen. Expecting to be in an updated state when I transition back.
how do I get the previous update state in the current screen when we switch back to the current screen from another screen.
current screen:
toggle-button pressed, the slider will appear, and setting the slider to half-way:
transitioned to another screen (co2 screen in this case):
Now ill press the back button here and ill go to the original screen again, at this time the screen state has to be like image 2 but it is not it is resetting to default like:
2021-02-24 09:43 PM
Hello Mk.3,
Don't worry that is completely normal. In fact, only one screen at a time is allocated so when you switch to another screen the previous screen data is deleted so when you come back it will be reinitialized. To avoid loosing data you need to use the MVP architecture and save your data in the Model.
Please have a look at this tutorial.
When your question is answered, please close this topic by choosing Select as Best.
/Alexandre