xxv / android-lifecycle

A diagram of the Android Activity / Fragment lifecycle
5.26k stars 681 forks source link

Explanation about when does onActivityCreated method not called #21

Open lujop opened 8 years ago

lujop commented 8 years ago

Can you explain what is fragment restart and why onActivityCreated is not called in it? I've tried with latest v4 support version 23.3.0 and I can't reproduce the case where onActivityCreated isn't called.

Here is some discussion about that: http://stackoverflow.com/questions/36858835/onactivitycreated-is-always-called/36858971?noredirect=1#comment61291313_36858971

nick1Jian commented 7 years ago

My guess is that in some rare cases, the fragment called onDestroyView() but the activity is not yet destroyed. When frag is resumed, the fragment still attached to activity hence no need to call on ActivityCreated()

But that's just my guess. Need more reference to prove that.