Search code examples
screenapp-inventortinydb

TinyDB on MIT App Inventor won't save data between screens


I'm a teacher of a CS class at a high school, and I don't have a ton of programming background, but my students are running into this issue:

They want to make an app that keep a username and password in a TinyDB so they can log in between screens. Right now, this is what they have: New User Screen New User Screen Login Screen enter image description here Note: here testbox1 is the username and textbox2 is the password When we've tried to get the tags on the login screen, they're wiped out. Don't know why...


Solution

  • To use a dynamic tag is problematic...

    let me recommend you to use 2 tags, the first tag could be "username", just store the username in that tag and as second tag you might want to use "password"... store the password in that tag

    then in the other screen first read the values of both tags

    Generally my recommendation is to Use different screens wisely
    Before starting to create another screen, first you should think about is it really necessary? See also Building apps with many screens and SteveJG's post about advantages/disadvantages, because in only one screen you also can use vertical arrangements to simulate different screens, just set the arrangements to visible = true/false as needed...

    Also you might want to switch screens correctly to avoid memory issues during runtime of the app, see here https://puravidaapps.com/manager.php

    btw. the App Inventor support forum you can find here https://groups.google.com/forum/#!forum/mitappinventortest