Return to an already opened screen

My application has a step by step of several screens where the user fills in information.
When he advances to the next screen or returns to the previous screen, I need the information on screen to be kept until the end of the process.

When I use the “Open Another Screen” block, a new instance of the screen is opening and not that screen with the data.
I need to reopen the previous screen or reopen the next screen, always keeping the data, just as the Back button does today.

To show content of previous screen, you will have to close the current screen. And to show content of next screen, you would have to pre-load the data at screen.initialise.

You will have to use storage for storing data and showing it later. Try using TinyDb for the same. For each screen, after the user enters or fills data, store the values in a list or a key:pair using dictionary, then store it in TinyDB under the tag name of the screen. And when the user opens that screen, call that data from db and display it. After the user completes all the steps of filling data, close the unwanted pages and clear the tags in TinyDB.

Alternatively, you could use single screen for filling the data, and avail the separation you get using different screens by using different vertical and horizontal arrangements, rather than using a list of screens. This will not only help you to skip through different steps of filling the data, but also allows the app to consume less memory. Try this method for more efficiency and simplicity.

Thank you!
I have that in mind.
But why do that if I could just reopen the screen with the data it already had?
If you press the Back button, it will have the same effect as I need, however, I need to say which screen I want to move forward or backward to, as I have the Next and Previous buttons for that.

You cannot just reopen a closed screen, and present it as it was showed earlier. When your are closing a screen, you are closing an activity. Ie, the data is not stored in ram anymore. You would have to manually program, to load data stored in memory into the fields at the initialisation of the screen.

I didn’t have the screen closed. I just opened a new screen.
So, by pressing the Back button, I am able to return to the screen with all the data the way I left it.

I need to do this in a controlled way, that is, go back to the screen that I left open, but not with the Back button.

See this for more info​:point_up_2::point_up_2::point_up_2:

1 Like

For large applications, it is very confusing and disorganized to do everything on one screen.

If I don’t close a screen, I should be able to go back to it, right?

This would cause your app to crash and consume lot of memory. Better use multiple arrangements and on clicking ‘prev’ or ‘next’ buttons change the visibility of each arrangement, as this would make it easy for you to show previous data without losing it, and makes the transition much more easy.

There are more screens, with less elements.
I will close the screens at the end of the process.
But until then, I want the user to be free to come and go.

For large applications it is not that hard. If you get too messy, then use a second screen, and then later use a third screen and so on. Being efficient is important. If you try to use multiple screens for large applications you might end up crashing your app or hanging up the users phone. Plan it wisely.

Because transition between screens, and viewing it previously entered data on loading is all very time consuming and memory eating. As far as my knowledge goes, that is very un efficient.

Thanks for the warning, friend.

I can’t understand why I can’t go back to an open screen like the Back button does.

@shotdesign Kindly go through this post. This might give you some idea I’m talking about.

I’ve already read it

That is possible, you can go back to the previously open screen by using the back button. When the back button is pressed, just close the currently opened screen. That is possible. What I said is, to again go back to the screen you were on, with the pre load data is difficult (not impossible)!!

Edit: consider you have 2 screens S1 and S2. You 1st open S1 and then opened S2 from S1. Now by pressing back button, you can go back to S1 without losing data on S1. But its is difficult for going back to S2 with the data you had earlier, without storing it somewhere and retrieving it on initialisation. This becomes more hectic when you have a third screen S3. You can come to S1 from S3 by closing S3 1st, then closing S2. But then to go back to S3 is kinda hard!!

This is what I meant!!:hot_face::hot_face:

The problem is that this only works for the back button.
I need to control this. Because the user needs to go back or forward.
Step1 -> Step2 -> Step1 -> Step2 -> Step3 …
When I get back to a screen, I want to see it exactly as I left it.
Doesn’t Kodular have a method for opening an open screen?
Why does he start a new instance every time?
Curious!

No… That is how activities work in android. Its not problem of Kodular. Dont blame them. Thats how google made it!!

OMG! Sorry, it was just a question.

It is intriguing to know that Android keeps all screens open in memory but does not allow you to return to them in a controlled manner.

I’m going to die and I’m not going to understand that.

1 Like

When you close a screen, its data is forever gone. Screens or activities are like stacks (like stacks of plates). In 10 plate stack if you want to take the 5th plate, you would have to remove the top 5 plates out of the stack, then the remaining stack will contain only 5 plates.

Simply switch to different arrangements, if you find it confusing. Start fresh. After all this is how you learn new stuff right!!