Save the current screen on exit app

hello i have a app wit multiple screens. every screen is a level of a game. i would like users to be able to save witch level they are so the game starts there next time.
i have a close button but thats all so far. please help me.

This is a bad idea because screens take up a lot of resources. You should never use more than 10 screens. Use one screen, and reuse that one screen for all levels.

1 Like

Whenever onStop() or onPause() is called, you can save the level or the Screen state to tiny db and read it back once the Screen is open.

and as Gordon Lu suggested, you should be rather using vertical arrgangements than Screens, or even a dynamic method if possible.

you need to save the game level when user enter this level, since some time user leave the game without clicking leave button.


thank you i ryed to use vertical arrangements but i have to much code, i didnt understand enough to ake it work so this is my sulotion.
i only have 10 screens. every app is a chapter in a game and every chapter is 10 screens.

that realy smart thinking, thank you. now how do i do that:)

No. Not virtual screens either.

For example, instead of ten screens with a label, why not use one screen with one label, and change the label's text when needed?

thank you but i can not do it. i tryed but nothing worked anymore. now i have ax 10 screens to a app and call it a chapter.
i am going to try your sulotion, thank you so much

i dont understand how that would work? but i am intrestit. can you tell me more or is there a tuteral somewere?

what exact data you want too store?

i dont now, i want the user to come back to the screen he last was. so i guess the current screen?
but the button i made is not working so im doing it wrong.

then just save screen name, next time open this screen

do i have to put the blocks in every screen or just in screen1?

Since you are using multiple screens you have to do it for each screen, the valueToStore for each screen will be different.

Save the data, not the screen.
Here is an example...


Screen2 etc:

Test app with 3 Screens:
goToLastScreen.aia (15.0 KB)

Thank you so much. but do i make a button for al 10 screens? because i raly would like it more to just have the one button for closing and saving te game.

the aia is wrong, if i try to get a apk file it cant do it, this is what it says.

can you tell me how to do that?

Try this one:
goToLastScreen2.aia (15.0 KB)