From the table at this link: http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle
we can see that an Android Activity is not killable until after onStop() has been called (for Honeycomb and beyond).
Do we have the same (documented) guarantee for Fragments?
Would greatly appreciate someone pointing me at documentation where it is clearly stated.
Edit: As has been pointed out [Fragment.onStop] is generally tied to Activity.onStop of the containing Activity's lifecycle.
http://developer.android.com/reference/android/app/Fragment.html#onStop()
But this doesn't tell me that Fragment's onStop() is guaranteed (at least not to the same level of clarity that the Activity documentation gives.) Is there anywhere that Fragment.onStop() guarantee is explicitly stated?
Edit 2: Based on the discussion below, we are now debating whether Activity.onStop() is guaranteed (it seems safe to assume that if not, then neither is Fragment.onStop guaranteed). I have moved the question about Activity.onStop to a new thread: Is Activity.onStop() guaranteed to be called (API 11 +).
It seems to me necessary, but not sufficient, that Activity.onStop is guaranteed to be called for Fragment.onStop to be also guaranteed.
onStop()
fragment is no longer visible to the user either because its activity is being stopped or a fragment operation is modifying it in the activity.
This is generally tied to Activity.onStop of the containing Activity's lifecycle.
http://developer.android.com/reference/android/app/Fragment.html#onStop()
In Low memory, it is not guaranteed for both activity and fragment will call onStop() method
Note that this method may never be called, in low memory situations where the system does not have enough memory to keep your activity's process running after its onPause() method is called.
http://developer.android.com/reference/android/app/Activity.html#Fragments
来源:https://stackoverflow.com/questions/29390760/is-fragment-onstop-guaranteed-to-be-called