android-lifecycle icon indicating copy to clipboard operation
android-lifecycle copied to clipboard

Activity.onPause() is called after Fragment.onPause()

Open xxv opened this issue 11 years ago • 3 comments

Fragment.onPause is called before Activity.onPause; ditto for onStop

(Reported by Kurt Huwig via personal email)

xxv avatar Aug 18 '14 15:08 xxv

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 / ☐→

xxv avatar Aug 18 '14 15:08 xxv

In my (very limited) testing, it seems that recent versions of the appcompat library pause fragments before activities.

ekux44 avatar Nov 09 '15 06:11 ekux44

@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.

milosmns avatar Sep 15 '16 20:09 milosmns