I always think finish() will fire onDestory() immediately.But in 4.3 it seems not the truth. I just want to know in which condition it'll happend ? sorry,I can't put all my code on here. It confused me a few hours,and I can't find any useful info about it.
onPause()
is the last method that's guaranteed to be called before the process can be killed—if the system must recover memory in an emergency, thenonStop()
andonDestroy()
might not be called. Therefore, you should useonPause()
to write crucial persistent data (such as user edits) to storage.
It doesn't matter if you used finish()
or the system killed your Activity on its own. If the system "wants" to recover memory, there's no guarantee that onDestroy()
or onStop()
will be called.