androidonpauseactivity-lifecycle

Is onPause() called when user closes the app from recents


I read a lot about activity lifecycle but I cannot find a simple answer. Let's assume someone is pressing Switch apps hardware button. When app is switched to a different app onPause() is guaranteed to be called. Also pressing Back (to close the app) or Home will invoke onPause().

But here is the question. When I open app list where I can switch between apps will just the button click invoke onPause()? I mean is just clicking Switch apps invokes onPause()?

It's not clear to me and the documentation doesn't describe that case.

EDIT: I was wrong saying that onPause() is not invoked after the button click only. I'm sorry.


Solution

  • Based on the Activity page, onPause() will be called. Any app that is in the foreground will call onPause() the moment the user pulls up the app list to start swiping away apps.