Skip to content

Instantly share code, notes, and snippets.

@jgilfelt
Created February 6, 2012 22:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jgilfelt/1755312 to your computer and use it in GitHub Desktop.
Save jgilfelt/1755312 to your computer and use it in GitHub Desktop.
Android - Managing single MapView Fragment state across multiple Activities
private GeoPoint center;
private int zoomLevel = -1;
@Override
public void onPause() {
super.onPause();
center = mapView.getMapCenter();
zoomLevel = mapView.getZoomLevel();
}
@Override
public void onResume() {
super.onResume();
if (zoomLevel >= 0) {
final MapController mc = mapView.getController();
mc.setCenter(center);
mc.setZoom(zoomLevel);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment