Couldn\'t find a solid answer to this anywhere. I have a method where finish() is being called, and onPause() is called afterward.
Is onPause() guaranteed to be cal
The system calls this method as the first indication that the user is leaving your activity (though it does not always mean the activity is being destroyed). This is usually where you should commit any changes that should be persisted beyond the current user session (because the user might not come back). so
onPause()
is guaranteed..The official documentation here
EDIT 1
onCreate()
is to onDestroy()
&& onStart()
is to onStop()
&& onResume()
is to onPause()
.. onStart()
is called when onCreate()
finishes its work. if not its not called.. onResume()
indicates the ui is about to be shown to the user -(An Activity's content is the screen the user sees).
if you call finish()
in onCreate()
, onPause()
will be skipped because onResume()
was never called same goes to onStart()
.. so in some cases you can say its not; but that will be false, because what's an Activity that is not a screen or serve as a container for screens-(Fragment).
and why would you call finish(); directly in your Activity's onCreate()
? From how Activities work in general, onPause()
will always guarantee is calling..