Skip to first unread message

Heather Rapp

unread,
Nov 15, 2016, 9:07:08 AM11/15/16
to MIT App Inventor Forum
Students of mine are trying to create a client app that is suppose to keep track of counts from screen 2 and 3 but the counts are to be presented in screen 1. I am wondering if this is even possible, and if so, when we go from screen to screen, is it possible to keep the tally until it is cleared by user choice? Thank you for all and any help you can give me! :)

Abraham Getzler

unread,
Nov 15, 2016, 11:14:09 AM11/15/16
to MIT App Inventor Forum

SteveJG

unread,
Nov 15, 2016, 11:27:26 AM11/15/16
to MIT App Inventor Forum
Yes, it is possible to transfer data between screens, the developer MUST use a TinyDB as just mentioned by ABG.  The references he provides show solutions using multiple screens.

An alternative is not to use separate screens at all; simply create virtual screens by using layouts that you hide or show.

Your entire app can be built on one screen.  A very neat idea ;  You do not have to pass information between screens using a TinyDB or passing variables that can get VERY complicated.     WIth mulltiple screens, you  duplicate variables for each screen since each screen' performs as its own independent app' even though the TinyDB tags are shared.

What you presently put on a your second or third screen can be put in two  Vertical Layouts, set Visible to false and shown when needed using true; the same is true with succeeding screens.   You need to initially set your Screen1 to scrollable  (so you can work with all the Vertical Layouts).  When you are finished, add a block in the Screen1 event handler set Screen1.Scrollable to false. perhaps to hide the second and third virtual screens until they are needed.

Coding on a single screen requires more thought than coding on multiple screens but a developer avoids the huge headaches of passing data between screens, duplicate variables on many screens to handle the data etc.

Look at the past advice on this forum regarding screens; ALL the moderators urge users to code on a single screen  or at the most one or two.  Users can build large apps on a single screen.

You might enjoy this  
despite the caption, the article is actually about building an app with only one or a few screens.

However, if you really believe you NEED  three screens for your app, use a tinyDb to pass the values.

Regards,
Steve
Reply all
Reply to author
Forward
0 new messages