Screen again and again initializing or use any screen as default screen

i have app with two screens "screen 1" and "Main_Page" i want when app open to open "Main_Page" Screen but by default, "screen1" opens then we move from screen1 to Main_page then i have buttons on Main_page when click on button move from screen Main_Page to Screen 1 and this process repeat again and again and never stop .i just want to use Main_page Screen as default Screen and remains on Screen1 if possible here is my code from Main_Page Screen
Screenshot from 2023-03-18 17-26-48
Code from Screen1
Screenshot from 2023-03-18 17-28-26

Use TinyDB to check, from which screen you are coming from and only open Main Screen if you are not already coming from Main Screen

Alternatively use the manager screen method and just close the main screen to be back in Screen1... you have to test this in the apk file... why? See the notes here App Inventor Tutorials and Examples: Manager Screen | Pura Vida Apps

Taifun

You cannot open and close Screen1. Screen1 must be in the background all the time. Opening and closing other pages, but never open and close Screen1.

You can
what he is doing is a variation of

Taifun

@Taifun You're right, you can close screen 1, but not closing it will solve the problem here. The problem is that after closing Screen1 and reopening screen1, initialize blocks will execute. In these blocks there is an automatic jump to Screen1, so Screen1 cannot be opened. The solution will be to not close screen1, keep it in the background.

Try it:

Blocks in Screen1:



Blocks in Screen2:

blocks (50)

test_screen1.aia (2.6 KB)

Third solution using the starting value:

Screen1:


Screen2:

test_screen1 (1).aia (2.9 KB)

1 Like

wow, great Third Solution works for me Thanks @Patryk_F you're genius

1 Like

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