Save data when change Screen

Hello everybody.
My app has 2 screens
In each of them there are some textbox.
If I write into them and I change screen, when I return on the previous screen the datas are deleted.
How can I save my datas obviously without creating a database?
Using VB, I could save the contents of the box into the property TAG. Is there something like this in AI2?
Thanks

You could always use tinydb component

Thanks for your answer.
The tinydb is a db?
I would not like to use a db, because my app is very simple, it doesn't need to save data from one session to another, but only inside the active session.

If you want to transfer the data from Screen1 to Screen2 you can do this :
Add this one in Screen1
blocks

And get the value in Screen2
controls_getStartValue


If you want to transfer the data from Screen2 to Screen1. Check this out :

https://community.kodular.io/t/f-os-static-variable-extension-an-extension-for-creating-static-variables-in-app/126214/28?u=salman_dev

TinyDb stores data in app so it will be available each time the app is run.

http://ai2.appinventor.mit.edu/reference/components/storage.html#TinyDB

Maybe don't use 2 screens. Make arrangements visible or not on one screens. That would make your app even simpler and you wouldn't need a tinyDB.

Thanks Salman_Dev,
but I don't have to transfer datas from a screen to another.
I have 2 different screens. I close the first and open the second, when I return to the first my datas of the first screen are deleted. I must recover these datas.

1 Like

Your idea is good, I'll try to do this but the 2 screens are quite different to switch on and off each controls.
If I can't I'll include the tinydb as dora_paz says.

2 Likes

You should place the components for each virtual screen in an vertical or horizontal arrangement and make that visible or not.

This may help you
https://groups.google.com/d/msg/mitappinventortest/K-zAr2X3nio/qzrDox_pBgAJ

https://community.kodular.io/t/f-os-static-variable-extension-an-extension-for-creating-static-variables-in-app/126214

Blocks on Screen1 & 2

1 Like

@Anke check this before posting that extension :roll_eyes:

https://community.kodular.io/t/f-os-static-variable-extension-an-extension-for-creating-static-variables-in-app/126214/23?u=salman_dev

but its saving grace is that it does allow a developer to pass a variable from one screen to another without using tinydb or startValue, the OP didn't want to use a database....

1 Like