How do you make a basic system that when you click a checkbox on one screen, it changes an image on another screen?

I want test out a basic mechanism in MIT app inventor that would allow me to check a text box in screen 1


And then on screen 2, the Red X would be changed to a star but if the checkbox on screen 1 wasn't ticked, that it would stay as the Rex X.

(It's ironic that i'm asking for help while I'm trying to do this test to help someone else on their project)
My problem is that I don't know how to go about using TinyDB to transfer the data of "Checkbox 1 on screen 1 has been clicked, change button 1's image to a star, but if it hasn't been clicked, keep it the same." I've tried a few methods but not much has worked. Can anyone help? Thanks

Do you have to use real screens ? Could this be done with Virtual Screens (much easier)...

If not, you need to use a tinydb to store the state of the checkbox, then in the other screen, check the tinydb value of the state of the checkbox, then if checked, set the corresponding image component to a star image.

Using virtual screens isn't an an option sadly as the person I'm coding this for already has the two screens they want with the checkboxes and the stars (Much more advanced looking than what I've shown as an example here) and I'm trying to do this to give them an example of how to do the code because they're new to MIT app inventor. Could you provide an example of how to use TinyDB to check the textbox and so on so forth that you've mentioned in your example?

showstar.aia (8.7 KB)

Behaviour may be slightly different with a compiled app...

  1. You may not be going to Screen2 from Screen1
  2. When compiled, Screen1 does not initialise when you return to it using close screen on another screen that was opened by Screen1. You may not need to use the Screen1 initialise blocks.
1 Like

Thank you so much! this is exactly what I was looking to do, you're a lifesaver!

Why? I do not think so.

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.