Properly exiting an application

adrianstanescu85

Active Member
Licensed User
Longtime User
Hello

I have an application with the Main activity which is actually kind of a splash screen (but the user has to confirm something there) and after that it turns on another activity (ActivityRol) that is the main one. It seems I cannot actually properly exit the application from either activity, that is end all of them!

If the user is still in Main (so ActivityRol hasn't been called yet) then when the Back key is intercepted and if the user confirms application exit by means of a message box, then the code I've tried is:

Activity.Finish
ExitApplication

This makes everything look like the app just exited, but if I click on its icon to restart it... BLANK PAGE! And yes, I can click the back key again, I get the same message box asking for application exit, so I can "exit" it over and over again!

The same thing happens if the user reaches ActivityRol being called and tries to exit from there, the mechanism is identical.

What is the proper way to actually make this application REALLY exit??

Thank you!
 

adrianstanescu85

Active Member
Licensed User
Longtime User
The proper way is to not exit at all and let the os handle it.

Actually I do need to exit it since the purpose of this app requires that. I believe though that it's just common sense to be able to end a process if you want to, especially if you're designing the app. This really is a must since in fact the app does not close and cannot be reused when restarting it.

Does anyone know how to programatically exit the application properly?
Thank you!
 
Upvote 0

adrianstanescu85

Active Member
Licensed User
Longtime User
I do agree on the application lifecycle idea but if anyone takes a look at the very large part of the apps on Google Play, most of them present this option of leaving the app. They must be doing this somehow, right?

And one other question, what does ExitApplication actually do in B4A?

Thank you!
 
Upvote 0
Top