Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android beginner: onDestroy

Shall I place commands before or after super.onDestroy() when overwriting an activity's ondestroy?

protected void onDestroy() {

    //option 1: callback before or ...

    super.onDestroy();

    //option 2: callback after super.onDestroy();
}

(Now I fear: If super.onDestroy is too fast, it will never arrive in option 2.)

like image 488
ledy Avatar asked Oct 12 '12 12:10

ledy


1 Answers

Anything that might be related to using the activity resources should be before the call to super.onDestroy(). The code after it will b reached, but might cause problems if it needs those resources.

like image 115
MByD Avatar answered Sep 28 '22 06:09

MByD