Skip to first unread message

Johnathan Clayborn

unread,
Oct 13, 2016, 2:21:21 PM10/13/16
to MIT App Inventor Forum
Hi All, I know that there are several posts and different ways of doing this. I apologize in advance for the questions, but a lot of people are posting information in these threads with images as the answer and the firewall I'm stuck behind won't let me open the images, which is frustrating, to say the least. I'm very new to this, so I don't quite understand the text descriptions in some of the other threads. 

here's what I have: 

When "Screen1" .Initialize:
do Open another screen : Screen name: "Splash"

That bit works no problem. I'm fairly certain that my error is on the Splash Screen coding itself. 

When "Splash" .Initialize:
do  Set "Clock1" . TimerAlwaysFires to True
      Set "clock1" .TimerInterval to "2"
      If  "Clock1" . TimerInverval = 0
      Then Close Screen. 

When I open the app on my phone, the splash screen does load. This tells me that the first block is calling the right page. 
But then the splash screen just hangs there. It never closes. 
If I click the "back" button on my phone, the splash screen closes and then I can see the menu. 

Abraham Getzler

unread,
Oct 13, 2016, 3:32:44 PM10/13/16
to MIT App Inventor Forum
Easy one.

The Clock has an event block (Timer?) that will fire after the interval expires.
Put the Close screen action in there.

There is no countdown attribute to look at.

The interval is measured in milliseconds, so 2000 sounds better than 2.

ABG

Johnathan Clayborn

unread,
Oct 13, 2016, 3:49:00 PM10/13/16
to MIT App Inventor Forum
Sweet! That fixed it. :) 

But now I have another problem that I think is related to my first block of code. 
The splash screen goes away like normal. 
However, after the splash screen it goes to a menu (Screen1). 
When I go away from the menu to another screen and then go back to the menu, the splash screen re-appears. 
I suspect that this is due to the "Screen1.Initialize" block. 
I think that I need to make that an If-Then conditional clause, but I'm not sure how. 

Abraham Getzler

unread,
Oct 13, 2016, 4:00:02 PM10/13/16
to MIT App Inventor Forum
I haven't seen your blocks, so I have to guess here.

Some sites with sample multiscreen apps have them opening Screen1 from another screen.
That's problematic, because it will fill up memory eventually.

In general, you have to close screens as often as you open them.

See the Screens section of this FAQ for common wisdom on screens ...

ABG

Boban Stojmenovic

unread,
Oct 13, 2016, 4:27:10 PM10/13/16
to mitappinv...@googlegroups.com
I think this still applies.

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.

You would have to build your app to see how it works.

Abraham Getzler

unread,
Oct 13, 2016, 10:16:06 PM10/13/16
to MIT App Inventor Forum
Thanks Boban - added your post to the Screens section of the FAQ
ABG

Boban Stojmenovic

unread,
Oct 14, 2016, 9:46:58 AM10/14/16
to MIT App Inventor Forum
Johnathan responded privately.
Thanks for this Boban. Unfortunately I did build the app and this is occurring on the installed version on my phone.

Strange
behavior, post your blocks so we can see what is going on.

Akshay

unread,
Oct 15, 2016, 4:00:50 AM10/15/16
to MIT App Inventor Forum
When I go away from the menu to another screen and then go back to the menu, the splash screen re-appears.

 How exactly are you returning to the Menu Screen (Screen 1)?, Let's say if you are having a Screen 2, to which you are going from the Menu Screen, did you use the  close screen to return to the menu? or once again opening the Screen1? Since I haven't seen the blocks, I'm guessing that you might be using the latter way. If so, I suggest you to use the close screen function to see if it fixes.


Regards.

Johnathan Clayborn

unread,
Oct 16, 2016, 2:13:57 AM10/16/16
to MIT App Inventor Forum
Ashkay, you are correct, I was using the "Open Screen" block rather than the "Close screen" block. 

I did figure out another way of doing this that bypassed my original problem. I'll post it here in case it helps other new coders. 

Originally "Screen1" was the menu screen. 
I had "Screen1.Initialize" control block open "splash" screen for 5 seconds, then close it. 
The problem was that every time I re-opened screen 1, the splash screen would come back. 

The solution that I found was to do some re-writing of the code. 
"Screen1" is now the splash screen. It displays automatically for 5 seconds. 
When the clock timer expires it opens "menu" screen. 
This is cleaner and it bypasses the re-opening problem. 

Akshay

unread,
Oct 16, 2016, 3:01:12 AM10/16/16
to MIT App Inventor Forum
Glad that fixes the issue. I thought of telling it, but the only downside of keeping the screen1 as the splash is that, it remains in the memory until the program is closed. This might be a problem on lower end devices, especially when using an image as a splash, which occupies some memory.

Regards.
Reply all
Reply to author
Forward
0 new messages