I have my AppMain
class [My class Name] that extended the Application
class in my app. That have some Globals.
I have mentioned inside the manifest. an
The app isn't actually running if it isn't consuming processor time (either running a service or presenting an Activity
to the user). It may be in memory but Android's memory management model is designed that way and the app will be killed if something else needs the memory. onPause
is a good indication that you may soon exit, and onDestroy
should free up any resources that an exit button would.
If you absolutely must exit, you can use finish()
instead, and/or try using the excludeFromRecents
or noHistory
flags in the manifest to avoid the crash. There should be a few others you can play around with, too.
See this question and the Process Lifecycle section of the developer docs.