Block user to go back

Hello there,

Is it possible to block the user from returning to the previous screen?

Example : if the user click to go to a new screen, he can't go back (he have to quit the app or find a button to return to main screen.


You can use when Screen backPressed block


This shouldn't even be possible if you switch screens correctly.
At the same time only a maximum of 2 screens should be open: Screen1 (main screen) and at most another one. So the screen you are talking about should already be closed.

So show your blocks.

1 Like



We need to see how you switch screens from Screen2 and Screen3.
So show all relevant blocks and post a test aia.

It's just WHEN CARD (button) .click => go to Screen2
the button is on the Screen1

And from Scren2, it's like @dora_paz said; the screen returns to itself.

I'm looking for a hidden way to go back to Screen1


This way at most 2 screens are open at the same time.


Both methods are good, yours is more fluid.
But if I have more than 40 screens to make like "Screen2", I have to create 40 more screens :sob: :sob:


1 Like

You probably do not need to create 40 more screens. More than 10 screens often causes issues with some apps for various reasons, that is why MIT recommends no more than 10 Screens. AI2 frequently becomes unstable when more than ten screens are used. Projects CAN be built with slightly more screens but then you should expect your app to occasionally behave erratically. Do not ignore the warning message that appears when you attempt to load your 11th Screen.

Nonetheless, see Are App Inventor Projects Limited to 10 Screens? - #7 by ewpatton or use virtual screens or re-use existing screens.

Yes I know but the 40 screens are just composed of two labels.
One of my app works correctly with 55 screens. And it's fluid
I will test it

Creating new screens (> 40 screens) to only display 2 labels each time makes no sense at all.

1 Like

Yes I could just edit labels

Can we switch to a new screen with specifics parameters and edit labels on this new screens ?

When clicking on a button that previously opened a new screen, simply change the content of the label.

My problem is that I have 40 buttons on Screen1 who switch to 40 screens which have two labels with different contents depending of the button clicked.
Could I have just 2 screens :
1 with 40 buttons
1 with 2 labels edited by the buttons on the first screen


Of course.

It can be done even with one screen. Here is an example with 2 screens using dictionary blocks. Each button click sets different text in labels in 2nd screen
multiple_buttons.aia (4.0 KB)

Screen1 blocks

Screen2 blocks


Thank you a lot !
Another question ; how can you do this but not with all buttons ? Like with exceptions
Or I need to make the code for all of buttons ?

The first part of the code in when any Button click checks if the button you clicked is in dictionary. If it is not then it won't do anything. You can add and else condition to do another action, it is up to you

Hi, @dora_paz

I try like you said but when I click on a button who is in the dictionary the page doesn't open and reopen Screen1
My code is exactly the same like yours just with a dictionary of 52 keys.

Do you know why ?

screen1 :

screen 2 :

I found the error message :

But I don't know what is mean