How do you send data bidirectionally between screens?

Hello.
I want to send a list from screen1 to screen2, modify this list in screen2 and get this modified list back to screen1.
How can I do it in a simply way?. Should I use tinyDB?
Tnak you.

Hello Alvaro,

you can use tinyDB or pass directly the list between screens with the blocks to open/close a screen with a value.

If the list has to be persistent (keep the list even when you close/reopen the application) then you need tinyDB.

Hi Ramón,
I pass the list directly from screen1 to 2, and it worked fine. But I didn't work the same method to pass the list from screen 2 to 1.

Can you show your relevant blocks for the two screens?

This may help you:

you need to follow this approach on both screens, in order to maintain the latest version of the list for both screens.

Finally I solved it passing directly the values:





Thanks a lot to all of you!

In your solution, you are not sharing a List but instead only one value?

Also, consider using Virtual Screens, they are perfect for this type of thing.

When we define virtual screens, we use one 'real' App Inventor Screen (most often Screen1). Screen-sized Vertical Arrangements on it are displayed/hidden as required - they are the Virtual Screens. This is generally a better approach for multi-screen Apps, they share data without having to "pass" it between screens and it also reduces code duplication, making the App more efficient and the code easier to follow if you have to return to it at a later date.

So, instead of separate "houses", virtual screens are "rooms" of the same "house".

You are opening scren2/1 each time you change...but you are not closing any screen....

Take look here:

App Inventor Tutorials and Examples: Manager Screen | Pura Vida Apps

1 Like

Yes, you are right in the example I pass one value, not a list.

To use virtual screens seems to be even a better solution. Any example of using that or link in youtube?

Thanks a lot ChrisWard

Thanks, I will take a look

I think if you search the forum there are some examples - you can present a tabbed interface where buttons are dressed-up to look like tabs

Snap1

Snap2