Which is the good place to ask user, whether (s)he wants to exit the app when (s)he clicked the back button? I considered the onPause
and onStop
, but t
If it's only when the user presses back (not home or whatever), use onBackPressed.
The doc says:
Called when the activity has detected the user's press of the back key. The default implementation simply finishes the current activity, but you can override this to do whatever you want.
So if you catch the backpress and don't do anything, the activity is not quit.
If you want to quit, use finish()