Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

SupportMapFragment and OnMapReadyCallback #7440

Closed
kjkrum opened this issue Dec 14, 2016 · 1 comment · Fixed by #9621
Closed

SupportMapFragment and OnMapReadyCallback #7440

kjkrum opened this issue Dec 14, 2016 · 1 comment · Fixed by #9621
Labels
Android Mapbox Maps SDK for Android

Comments

@kjkrum
Copy link

kjkrum commented Dec 14, 2016

SupportMapFragment only retains a reference to a single OnMapReadyCallback, which it passes to its MapView in onStart(). It does not test this reference for null. Nor does it clear this reference, so the callback will be called again every time onStart() runs. Compare this to the behavior of MapView, which retains a collection of callbacks and removes them as they are called.

Is there a reason SupportMapFragment#getMapAsync(...) doesn't simply call through to MapView#getMapAsync(...)?

@cammace cammace added the Android Mapbox Maps SDK for Android label Dec 14, 2016
@kjkrum
Copy link
Author

kjkrum commented Dec 17, 2016

Forwarding the fragment's getMapAsync(...) directly to MapView#getMapAsync(...) seems to work fine. The only problem is that Fragment#onCreate(...) is called before Fragment#onCreateView(...), so the fragment still has to store and forward callbacks before onCreateView(...).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Android Mapbox Maps SDK for Android
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants