Any good reason because my aia does not open an existing screen?

Hello guys, my app has 9 screens, the root screen is Screen1, it runs just the time to init everything then it opens DownloadData the first time to download a DB, then it opens the Main screen. In Main there are 5 buttons to open other 5 screens. To simplify the management of different media, the Guide screen when reads a QR code opens the corresponding screen for the right media: PlayImage, PlayAudio, PlayVideo. But in the apk seems that from the Guide screen I am not able to open any scrren, not only one of the three media related screens. Instead, from Main I open Guide screen and other screens. The way I open the screens is always the same. I remember a limit of 10 screens to do not overcharge AI2 but is a real limit or may I have more then 10 screens? My screens are not so heavy.

Use different screens wisely

If you decided to use different screens, then you should switch them correctly, else you will run out of memory after a while...      
The recommended method of switching screens in App Inventor
(Thanks Taifun)
 
Also see demo: multiscreen.aia
 
1 Like

yes it was necessary, I already designed other multi screen apps with no problems but normally I open all the screens from the same root screen. I this case Screen1 starts, the if no DB loaded opens DownloadData screen, the user selects the DB then download it and return to Screen1. Screen1 then opens Main Scree that basically is a menu, there are 5 buttons to open other 5 screens and a button to close the app. Guide Screen is opened by Main, inside there is a QR code reader and recognize the media type so it should open PlayImage, Play Audio or PlayVideo. When the user closes one of these screens they return to Guide Screen and when he closes Guide Screen it returns to Main Screen. But from Guide Screen seems I am not able to open any screen, not only the 3 Play screens.... may be a limit that I can not open a screen from a not root screen?

Can you replicate the problem with a simple example aia project ? This is often a useful debugging exercise in finding the problem.

You write plenty of text about the issue, but you do not show any blocks/screenshots on how your switch screens in your project

Without showing you an example aia where we can test it, we can't say much about it. Personally, I certainly wouldn't use so many physical screens.

because they are really no more then open another screen with start value and passing the name of the screen and a value that during the tests will be a number between 1 and 7 (just 7 QR codes and 7 media to test). Now I am testing if I am able to open one of the Play screens from Main just changing 3 buttons click function to test if that may be the problem.

We will leave you to it then.

When you are ready to help us to help you, and provide an example aia project that replicates the problem, let us know.

Yes I understand, I would like to know if apart memory problems/limit there is a fixed limit about the number of screens and if a screen opened by a parent screen may open another screen of this is not possible. Of course if this is a known information or is a limit written somewhere... or if you had the problem in the past, I don't ask you to have a crystal ball...

A short update: from the Main screen I am able to open any screen, also the PlayXX screens. Now I have to quickly modify my app to go back to Main and open one of the Play screens but when I will have finished I will write a couple of test apps to see if it is a memory problem or a problem that only a "root" screen can open a screen, so a screen may have only one parent and no "grand parent" or any other ancestor.

You can, with the correct blocks, switch from any screen to any other screen.

When opening and closing screens correctly, there should be no problem with screens, including memory. If you do it incorrectly, you may have a memory problem.

I made a short app that mimics exactly how my original app opens and closes the screens. In this case the screens are pretty empty but it works so the problem should not be related to screen switching.
TestNestingScreens.aia (12.9 KB)

So you answered yourself. No problem with screen switching :wink:. So what is the problem with this topic?

I am investigating.... because in the demo app to test screen switching everything works as I would had expected since the beginning but the app still has the problem. So, the problem is not solved but at least I eliminated one possible cause.

Yes, apps with more than 10 screens can also work well (especially if they are not too "heavy"). The 10 screens rule is only a (strong) recommendation.

1 Like

I mainly follow this rule. The aia in a previous post basically shows the screen management of my real app. I just put buttons instead logic to decide to open PlayAudio or PlayImage or PlayVideo but it is just a if.. else if checking the media file type so no far from to have 3 buttons instead.
Shortly: the app starts in Screen1 that remain active to init everything. Only the first time some TinyDBs are empty so Screen1 opens DonwloadData Screen (that is not present in my demo app) then comes back to Screen1 and then Screen1 opens Main Screen. Main Screen basically is a menu, 5 buttons to open other screens and one button to close the app. In Main Screen one button opens the Guide Screen. This is basically a QR code reader, in the QR there is a link to a media file (downoaded the 1st time, work done in DownloadData Screen automatically) and depending on the media file type it opens one of the three Play Scrrens (PlayAudio, PlayImg,PlayVideo). At the end the user closes the PlayXX Screen and then comes back to the Guide Screen. So I think to have 1 screen active and other 3 screens opened in the worst case. I could merge Screen1 and Main without much work I think. If it will be not sufficient, always with the idea t reduce the number of screen in backgroung, after having identified the type of media file instead of open the right Play screen I could close Guide screen so Main screen and from Main I could open the right Play Screen. I do not think merging the 3 Play screen in one screen may be of any help considering that seems not to be related to the total number of screens.

No.

The switching seems to be correct if you actually have a maximum of 3 screens open at the same time. If it's not a problem with the switching logic you didn't include in the example that you mention, then you can try keeping only one screen open and the rest closed.. Unless you are missing some detail that actually makes the number of open screens increase in memory.

Why no? In any case looking in the aia I found everything, no screen is missing, the call inside Guide screen neither. So, if something is missing it should be in the apk, always if the error message is correct.