App is crashing on every first launch

I designed a app with 6 screens(actual application) and i was toggling between screen correctly and there was no error but when i close the application using close application block, next time i open the app it crashes for first time and for the second time it opens.It happens every time the app is closed with close application block.As the original application was big i created a new app which creates the same error, the blocks are shown below,
First screen
Screenshot (150)
Second screen


Apk file :
trial (1).apk (4.8 MB)
Aia file :
trial.aia (3.0 KB)
To reproduce the error-
open app, go to screen 2, click on close application (the application will close) and then open app ,and the app crashes without any error or message and again open app it opens .

1 Like

First, open a new screen and then, close the current screen.

see here:

1 Like

Is it necessary to close the screen before we close the application? Close application block doesn’t close all screens already?

closing screen is not a problem , the problem is app crashes when we use close application on first launch.

Closing block is working fine, but the the problem is app crashes when we use " close application" block on first launch after closing application.

I think no.

Remove

From Screen2

2 Likes

if i remove close application, how to close application.

As I told you

1 Like

like this ?Screenshot (151)

1 Like

Yes. build it and see what happens

works like charm, what was wrong with close application block ?

You need to have an underlying screen for the close application block to work on second screen

1 Like

what does that mean, i have to use close application directly without closing current screen, unfortunately that also induces the same problem, but if i return to screen 1 the same method (which produces error when exited from screen2) works perfectly.

Android apps continue to run in the background, even after you’ve moved on to other tasks or close the app.

Screen2:
grafik

Since “close application” could no longer be executed after “close screen” on Screen2, this command remains in the background so that it is first executed the next time the app is opened. This immediately closes the app. It is NOT a crash! If you open the app again afterwards, it works.

So, for whatever reason this approach is desired, try this on Screen2:

grafik

That doesn’t mean you should do it that way, it should just demonstrate how the processes work.
So build APK and try.

4 Likes

Note: If you kill all background apps or only this (using the task manager) before you reopen the app, even your first approach will work (proves the same).

2 Likes

wonderful explanation, Thank you.

1 Like

But if you Close application from screen 2 without closing screen (by disabling the closecurrentscreen block) then also app closes on first launch.

yes that’s 100% right, i have tried it.

1 Like