Is Activity.onStop() guaranteed to be called (API 11 +) -


it unclear (to me, @ least) documentation whether activity.onstop guaranteed called. there 2 places seemingly contradictory information.

  1. javadoc activity.onstop:

note method may never called, in low memory situations system not have enough memory keep activity's process running after onpause() method called.

  1. documentation (in particular 'killable' column) activity class http://developer.android.com/reference/android/app/activity.html#activitylifecycle:

starting honeycomb, application not in killable state until onstop() has returned. impacts when onsaveinstancestate(bundle) may called (it may safely called after onpause() , allows , application safely wait until onstop() save persistent state.

it's bit of struggle find way both pieces of documentation telling truth. scenario can think of this: suppose developing on target api 21 (with min sdk 10) , write activity onstop() method. if run application on api 10 phone, onstop() not guaranteed called. scenario means documentation points 1. , 2. above both true. otherwise, 1 of them must false.

is activity.onstop() guaranteed called (api 11 +)

yes, guaranteed called on post-honeycomb devices (api 11 +)

source 1: video tutorial on activity life cycle - taught google developer advocate

source 2 & image source: androidlifecycle article on www.vogella.com

image sceenshot www.vogella.com


Comments

Popular posts from this blog

javascript - AngularJS custom datepicker directive -

javascript - jQuery date picker - Disable dates after the selection from the first date picker -