Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,16 @@ public void onCreate(Bundle savedInstanceState) {
protected void onResume() {
super.onResume();
setUpMapIfNeeded();
if (getMap() != null) {
startDemo();
}
}

private void setUpMapIfNeeded() {
if (mMap != null) {
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.

}

/**
Expand Down