Error in initialization Initial screen

Good evening everyone, here I am again with a new problem, I have an app with two screens, respectively screen1 and config. Screen1 is the main one, which before opening must take a value from memory. Unfortunately it does not compile my app, and on the code that I post it gives this error: the initialized event is executed when the screen starts and is executed only once per screen. here is the code:

Remove the other Screen Inilialized event from your blocks, you can use each event only once

Taifun

Hi Thanks Taifun I solved the problem, but I noticed that the initialize operation is only executed once, when I return from config to screen which is the main screen, it does not execute initialize again, and I need to reread an updated value in TinyDB. How can I solve it? Thanks. Here is the initialize code that executes, I would need it to only execute the rereading from TinyDB.

Im talking about the same screen
Of course you can have again an Initialize event on another screen

Just click onto the red error to see the error message

Taifun

switch screens correctly, see here App Inventor Tutorials and Examples: Manager Screen | Pura Vida Apps and read about the companion app limitations there... you might want to use App Inventor Tutorials and Examples: Multiple Screens | Pura Vida Apps to switch screens

Taifun

1 Like

Good evening Taifun I followed your suggestion but I could not solve my little problem. Basically I have an app with two screens, which are screen1 and config. Screen1 with a button calls Config to insert customization parameters that writes them in TinyDB. When I return to Screen1 how can I reread the parameters from TinyDB. Would there be an event that when I return to Screen1 re-executes Initialize of Screen1?
image

If you follow the Manager screen method, then event Screen1 OtherScreenClosed will get triggered after closing screen config (apk file)

The limitations of the companion app are the following as described here App Inventor Tutorials and Examples: Manager Screen | Pura Vida Apps

Current limitations of the AI Companion app:

  1. The close screen block triggers the Initialize event instead of the OtherScreenClosed event.
  2. The close screen with value block triggers both the Initialize and OtherScreenClosed events instead of only the OtherScreenClosed event.
  3. The close application block does not work, a message 'Closing forms is not currently supported during development' will be displayed instead.

As mentioned earlier

This method keeps only 1 screen open at any time and triggers Screen1.Initialize after opening Screen1 again

Taifun