I've been studying Google IO 2012 code
In one of the activities (HomeActivity.java) they're doing as follows:
void onCreate(Bundle savedInstance)
{
if(someCondition) {
// start some other activity here
finish(); // finish this activity
}
if(isFinishing()) return;
// More code here
}
I wonder why they do not put return
right after finish()
but instead checking isFinishing()
?
An Activity can be finished in a number of ways.
finishActivity
from an activity that has called startActivityForResult
finishAffinity
and finishFromChild
So isfinishing
is used to account for such cases.
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