Is there any particular situation when it is handy to not quit the Activity immediately after calling finish() ?
(in other way, why is this method not quitting the Activity immediately from design?)
http://developer.android.com/reference/android/app/Activity.html#finish()
UPDATE
When I say immediately, I mean, right in time you will call the finish() and of course, cleaning up with saving instance bundle, onStop and onDestroy methods doesn't count.
To see an example what am I talking about, here is the snippet
onCreate(Bundle savedInstance){
// code executed
if(somecondition){
finish();
}
// code which shouldn't be executed
}
the question is, why is the code after condition finished as well before ending activity, and why the finish() call not stopping the processing immediately
Shouldn't you do a return to prevent the codes below to execute:
if(somecondition){
finish();
return;
}
Imagine you have a thread_0 with a loop handling all the events.
Calling finish adds a new event, but the activity isn't killed until thread_0 handles the event.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With