Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed initialization called multiple times #13

Conversation

mg6maciej
Copy link
Contributor

See how compareDistanceBetween demo behaves when you open it, press HOME and go back. There are 4 markers.

@@ -33,6 +30,9 @@ private void setUpMapIfNeeded() {
return;
}
mMap = ((SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map)).getMap();
if (mMap != null) {
startDemo();
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I recall moving startDemo() to onResume() because some demo I was working on didn't have the camera initialised at the onCreate() step.

Could you remove the setUpMapIfNeeded() call from onStart()?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not a problem setUpMapIfNeeded is called in various places. Actually it is good for these rare cases, where user didn't update Google Play Services app.

    if (mMap != null) {
        return;
    }

stops startDemo from being called multiple times.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IIRC, I was trying to call moveCamera() inside onCreate(). I think it was too early. But this will work fine for all demos that exist at the moment.

broady added a commit that referenced this pull request Aug 16, 2013
@broady broady merged commit 6d41bbe into googlemaps:clustering Aug 16, 2013
@mg6maciej mg6maciej deleted the fix/initialization_called_multiple_times branch August 16, 2013 18:53
broady pushed a commit that referenced this pull request Feb 11, 2014
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants