When screen1 back pressed do close application

As I used this block…the app instead of closing , it goes to some times screen 2 or screen 3 or 4 or five…I checked for any mistake but there is no such block which can cause this problem…

The reason might be that you aren’t switching screens correctly:

Using open another screen block will only open the another screen and the old screen will remain in the stack and won’t be closed :slightly_smiling_face:
Note : that doesn’t happen in the companion, as the companion simulates multiple screens by drawing the new screen and clearing the previous one, the APK opens another screen and keeps the previous screen in stack , hence, closing the new screen, will move the previous screen to the foreground.

5 Likes

Show us yours blocks.
You can do : disable one block at a time and check the result.

1 Like

BTW, no need of creating multiple screens . you can create arrangement and then, visible or non visible on BackPressed and open another screen.

Actually I have used different switch options on menu bar …but that should not disturb because they behave like buttons and work only on clicks…

If u insist on blocks I will provide tomorrow Inshallah

1 Like

Are you using these blocks?
blocks

1 Like

I have created as your wish also but it needs more screens also for easiness

1 Like

Not only for me… For all users that can help you.

:thumbsup:

1 Like

Last time I used back press with clock ( if pressed 2 close etc) then …if back pressed call notifier …yes or no …if get choice …etc… Then I thought that error persists still …instead of using these methods…then I used simple if back pressed close app

What happens if you do this?
blocks(1)

Just a suggestion

1 Like

Note: if you only use the open another screen and never the close screen block, you will run out of memory after a while. Also reopening an already opened screen is a bad idea. For example, if you open Screen1 twice, you also have to close your app twice!

As @Mohamed_Tamer said, you must close screen when switching screens. Or else it will keep running and you will have to keep closing application until all of the screens is closed.

Use the suggested method mentioned by @Mohamed_Tamer or @Douglas_Maueski

2 Likes

Not tried this extra. I will try…thanks thanks thanks

What is extra benefit of it …helps to close screen without stand?

In my app I have used this block logic, and it has worked well for me.
Maybe it can work for you too. Do the test.

1 Like

I used these blocks in my applications.

blocks(2)

The logic here is:
When you switch from the home screen to screen 2, the home screen is closed.

2 Likes