What is right?
@Override
protected void onPause() {
// myCode
super.onPause();
}
or
@Override
protected void onPause() {
super.onPause();
// myCode
}
This entirely depends on whether you want your code to be run before or after the super implementation. There's no right or wrong.
See these two examples:
// prepend instructions to onPause
@Override
protected void onPause() {
Log.debug("About to pause application...");
super.onPause();
}
vs
// append instructions to onPause
@Override
protected void onPause() {
super.onPause();
Log.debug("Just paused the application...");
}
In the specific case of onPause
however, you should always call super.onPause
first. See Pausing and Resuming an Activity.