Activity.onPause() is called after Fragment.onPause()
xxv opened this issue · comments
Steve Pomeroy commented
Fragment.onPause is called before Activity.onPause; ditto for onStop
(Reported by Kurt Huwig via personal email)
Steve Pomeroy commented
v19 lifecycle goes:
I/LifecycleLog(28061): TestFragment.onPause / →☐
I/LifecycleLog(28061): TestFragment.onPause / ☐→
I/LifecycleLog(28061): MainActivity.onPause / →☐
I/LifecycleLog(28061): MainActivity.onPause / ☐→
whereas the compat library goes:
I/LifecycleLog(28061): MainFragmentActivity.onPause / →☐
I/LifecycleLog(28061): TestCompatFragment.onPause / →☐
I/LifecycleLog(28061): TestCompatFragment.onPause / ☐→
I/LifecycleLog(28061): MainFragmentActivity.onPause / ☐→
Eric Kuxhausen commented
In my (very limited) testing, it seems that recent versions of the appcompat library pause fragments before activities.
Milos Marinkovic commented
@ekux44 Calling super.onWhatever()
inside all Activity lifecycle callbacks will invoke those lifecycle events on the Fragment Manager, and thus forwarding those events to each of the living fragments.