Does it change anything to write :
@Override
protected void onDestroy() {
MydbHandler.close();
super.onDestroy();
}
Or
@Override
protected void onDestroy() {
super.onDestroy();
MydbHandler.close();
}
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
The general recommendation is:
For lifecycle methods with clear “creation” semantics (e.g.,
onCreate(),onStart(),onResume()), chain to the superclass firstFor lifecycle methods with clear “destruction” semantics (e.g.,
onPause(),onStop(),onDestroy()), chain to the superclass last, after any of your workFor everything else, it hopefully does not matter unless documented otherwise
Hence, it’s generally better form to use your first snippet. That being said, I am not aware of any actual problem with your second snippet — in fact, I used that same approach for my first couple of years of Android development.