Sharing Data Between Screens

Screens are like individual apps that you can switch between. They don’t share variables or blocks, so getting information from one screen to another takes a little bit of setup.

One of the more convenient ways to get data across screens is to use TinyDB. Anything you store in TinyDB is available in all the screens. TinyDB stores its data on the phone, not in the app itself, so the data in it persists even when the app is closed or screens are switched.

For example, you might have a page where the user can specify settings. Whenever a setting is changed, it gets stored immediately to TinyDB. This way, when the app is closed, those settings are remembered and honored. Now, because it uses TinyDB, those settings can ...

Get Learning MIT App Inventor: A Hands-On Guide to Building Your Own Android Apps now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.