2013年8月18日星期日

Android super.onDestroy (); issue.

My question is very simple , in my coverage onDestroy (), the method needs to call the parent class onDestroy.
I just do not understand the timing of the call , as the following two .

protected void onDestroy() {       
    super.onDestroy();
    // My code;
}


protected void onDestroy() {       
    // My code;
    super.onDestroy();
}

Consult great God, which is the right way ?
------ Solution ---------------------------------------- ----
general is this:
protected void onDestroy () {
/ / My code;
super.onDestroy ();
}

but depending on your code when onCreate how to call
------ Solution ------------------------ --------------------

if the strict point . Must be such that the order in which you do the treatment has been completed, and then release the parent resource
protected void onDestroy () {
/ / My code;
super.onDestroy ();
}
------ Solution ----------------------------------- ---------
generally no difference if your code just do your own thing sequential relationship lacks the prerequisite course there is no reference to the parent class has been released resources ( basically never met , all do their )
------ reference ------------------ ---------------------
protected void onDestroy () {
/ / My code;
super.onDestroy ();
}

should use this ! ~
------ reference - --------------------------------------
all OK , but there is a call to order , super.onDestroy () call is the parent class approach.

没有评论:

发表评论