When should super.onResume();
be called, on the first line of onResume()
or on the last line?
protected void onResume() {
Log.i
Whether or not you choose to call the super method depends upon whether you require the inherited functionality. You can often find out if you need to call the super method from Api documentation.
Sometimes you need to do something before the super method is called (ie filter an attribute or perform an action). Sometimes your code has to happen after the super method has executed.
It is very much implementation specific.
Android’s source code can tell us everything. If you check the Activity super class you can find the following lines:
protected void onResume() {
if (DEBUG_LIFECYCLE) Slog.v(TAG, "onResume " + this);
getApplication().dispatchActivityResumed(this);
mCalled = true;
}
On this basis, no matter before or after it is called.
there is an example on the following link:
Android -- How to properly handle onPause/onResume methods?