Buttons are not working to switch between screens

below button1 on screen1 doesn't switch to screen2 ; similarly button1 on screen2 doesn't switch to screen1



1 Like

Are you testing in the Companion?

1 Like

sorry, what do you mean by companion ?

1 Like

I'm testing using the website + the emulator and in both of them buttons are not working

1 Like

Which option do you use to test?

  • Connect or
  • Build


1 Like

(Canned response courtesy of TimAI2)

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

I think I see where you went wrong.
You are working only in the Designer.

Please watch this intro to the end ...


and see here:


1 Like

connect emulator

No I'm not working only in the designer as I am already shared above my block code for buttons on both screens

Don't mind me, but this isn't really the correct way of opening screens; you may incur a lot of wasted storage by not closing the screen (i.e., it will run in the background). Here's the accepted way:

1 Like

This option runs your app under the Companion on the stock MIT emulator.

The Companion does not support screen switching.
To test screen switching, Build an .apk file and install it on your device or an emulated device.
(ABG retraction)

It doesn't?

The Android companion simulates screen switching by informing the web editor when a new screen is opened, which causes the web editor to switch to that screen and send the corresponding code. The iOS companion more closely simulates what happens in a real app by pushing a new screen onto the view stack. In either case though, you should think of the set of open views as a stack. Opening a screen should be considered creating a new object (like clicking the link on a webpage pushes the current page onto the "Back" stack). Closing the screen does the opposite (equivalent of pressing the Back button in your browser).


Apparently, I am wrong.

I gave up on multi-screen apps so long ago, I can't recall when I saw the Companion complain about screen switching.

My apologies!


You may have been recalling that the companion does not allow closing the app, which it does because closing the companion would disconnect the session.

These blocks work (of course) also with → Companion and the → Emulator:
switchScreens3.aia (4.4 KB)

Only one screen is open at a time.


Thanks all for your support and great help, I have found that the issue is mainly in the live test on the browser itself, the application on browser was working before and now it is not working.

However, my code is working normally when testing either with the AI companion or emulator.

The issue here is when trying to test the code from just the web browser. [buttons are not switching to other screen]

There is no live testing in the browser.

1 Like

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