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

A diagram of the Android Activity / Fragment lifecycle

Results 27 android-lifecycle issues
Sort by recently updated
recently updated
newest added

Documented the case where a Fragment is popped from a FragmentManager's back stack and reused. This causes the Fragment to recreate its child FragmentManager, reattach, and run onCreate() again. It...

…ck in fragment Android M deprecated the onAttach(Activity) callback and introduced the new onAttach(Context) callback. To be backward compatible Android M and above calls _both_ lifecycle functions which may lead...

Fact: `onCreateOptionMenu()` called ones but `onPrepareOptionMenu()` every time. Proof: [onCreateOptionMenu() is only called once, the first time the options menu is displayed. To update the menu every time it is...

Update the diagram with the quarks introduced with multi-window mode to the lifecycle. Such as the recommendation to have video apps handle playback play/pause in onStart/onStop instead of onResume/onPause

missing in Fragment lifecycle: `onActivityResult`. Maybe it's same as in Activity? Called after `onStart()`? ``` @Override public void onActivityResult(int requestCode, int resultCode, Intent data) { ```

是我代码的问题还是?

Based on my experience and this discuss. I supposed that onActivityResult() should invoke after onRestoreInstanceStatus() https://stackoverflow.com/questions/5059028/state-of-activity-while-in-onactivityresult-question [ActivityThread](https://android.googlesource.com/platform/frameworks/base/+/master/core/java/android/app/ActivityThread.java)

According to Android doc: (https://developer.android.com/reference/android/app/Activity.html#onSaveInstanceState(android.os.Bundle)) In Fragment, this method may be called at any time before onDestroy(); But in Activity, this method will be called before onStop() without guarantees against...

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

question

The Activity diagram indicates that onPostCreate() is called regularly after onStart(). However, I am seeing that onPostCreate() seems to be called only once per onCreate(). It is not called again...