Android: Google Maps v2 - Prevent map from resetting upon rotation

An annoying quirk with the Google Map fragment is when you rotate the activity, it'll reload and reset the map.

To prevent that, make sure you set retain instance to True.

protected void onCreate(Bundle savedInstanceState) {


int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());

if (status != ConnectionResult.SUCCESS) {
int requestCode = 10;
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);;

SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(;

// Check if first run
if (savedInstanceState == null) {
// Prevent map from resetting when screen rotated

And that should be the end of that!

Then suddenly, CAT'S HEAD out of nowhere!

Copyright © Twig's Tech Tips
Theme by BloggerThemes & TopWPThemes Sponsored by iBlogtoBlog