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) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_map);
int status = GooglePlayServicesUtil.isGooglePlayServicesAvailable(getBaseContext());
if (status != ConnectionResult.SUCCESS) {
int requestCode = 10;
Dialog dialog = GooglePlayServicesUtil.getErrorDialog(status, this, requestCode);
dialog.show();
return;
}
SupportMapFragment supportMapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
// Check if first run
if (savedInstanceState == null) {
// Prevent map from resetting when screen rotated
supportMapFragment.setRetainInstance(true);
}
}
And that should be the end of that!
Then suddenly, CAT'S HEAD out of nowhere!