Often when you stumble across a problem like this, you need to look at encapsulation rather than extension. Can't you use the MapView as a member variable?
If you check out the MapView API, it states that we must implement the Android life cycle for the MapView in order for it to function properly. So, if you use a MapView as a member variable, you need to override the following methods in your main activity to call the matching methods in the MapView:
onCreate(Bundle)
onResume()
onPause()
onDestroy()
onSaveInstanceState(Bundle)
onLowMemory()
As an example, your Activity would look like the following:
public final class MainActivity extends Activity {
private MapView mMapView;
@Override
public final void onCreate(final Bundle pSavedInstanceState) {
super(pSavedInstanceState);
this.mMapView = new MapView(this);
/* Now delegate the event to the MapView. */
this.mMapView.onCreate(pSavedInstanceState);
}
@Override
public final void onResume() {
super.onResume();
this.getMapView().onResume();
}
@Override
public final void onPause() {
super.onPause();
this.getMapView().onPause();
}
@Override
public final void onDestroy() {
super.onDestroy();
this.getMapView().onDestroy();
}
@Override
public final void onSaveInstanceState(final Bundle pSavedInstanceState) {
super.onSaveInstanceState(pSavedInstanceState);
this.getMapView().onSaveInstanceState(pSavedInstanceState);
}
@Override
public final void onLowMemory() {
super.onLowMemory();
this.getMapView().onLowMemory();
}
private final MapView getMapView() {
return this.mMapView;
}
}