It is unclear (to me, at least) from the documentation whether Activity.onStop is guaranteed to be called. There are two places with seemingly contradictory information.
- Javadoc for Activity.onStop:
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.
- Documentation (in particular 'Killable' column) for Activity class http://developer.android.com/reference/android/app/Activity.html#ActivityLifecycle:
Starting with Honeycomb, an application is not in the killable state until its onStop() has returned. This impacts when onSaveInstanceState(Bundle) may be called (it may be safely called after onPause() and allows and application to safely wait until onStop() to save persistent state.
It's a bit of a struggle to find a way that both pieces of documentation are telling the truth. The only scenario I can think of is this: Suppose you are developing on target API 21 (with min sdk 10) and write an Activity with an onStop() method. If you then run this application on an API 10 phone, onStop() is not guaranteed to be called. This scenario means that the documentation from points 1. and 2. above are both true. Otherwise, one of them must be false.