I was wondering: When using Google Maps v2, the mapView should call
mapView.onPause()
in onPause().
Should however super.onPause() be called before mapView.onPause(), or afterwards? Should it be like this:
@Override
public void onPause()
{
super.onPause();
mapView.onPause();
}
or like this:
@Override
public void onPause()
{
mapView.onPause();
super.onPause();
}
? Both seem to work (no errors in the compiler nor while running the app), but what is the correct usage?
Go for the latter. On methods onCreate()
, onStart()
, onResume()
etc. call super
first, to init all object internals before you code may use it, while on onPause()
, onDestroy()
first cleanup your stuff then call super
to let superclass do its job too, otherwise your code may try to depend on stuff that is no longer available after super
cleaning completed.