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

MapboxMap.removeAnnotations() doesn't remove markers #4553

Closed
vfaSonnt opened this issue Mar 31, 2016 · 4 comments · Fixed by #4555
Closed

MapboxMap.removeAnnotations() doesn't remove markers #4553

vfaSonnt opened this issue Mar 31, 2016 · 4 comments · Fixed by #4555
Assignees
Labels
Android Mapbox Maps SDK for Android bug

Comments

@vfaSonnt
Copy link

I just upgrade to 4.0.0 and this bug happen.
Method removeAnnotations() doesn't work anymore.
But removeMarker(Marker) still work.
I check on both android OS under 5.0 and above 5.0.
Both my project and Mapbox Example Source.

@tobrun tobrun changed the title (Android) MapboxMap.removeAnnotations() doesn't work on version 4.0.0!!!! MapboxMap.removeAnnotations() doesn't remove markers Mar 31, 2016
@tobrun
Copy link
Member

tobrun commented Mar 31, 2016

@vfaSonnt thank you for brining this to our attention.
I was able to reproduce this initial screen:
device-2016-03-31-102921

mapboxMap.removeAnnotations is being called when I press the garbage bin in the options menu:

device-2016-03-31-102946

Not all the markers were removed but some are. I'm guessing that the ids passed to core are not correct.

@tobrun tobrun added the Android Mapbox Maps SDK for Android label Mar 31, 2016
@tobrun tobrun added this to the android-v4.1.0 milestone Mar 31, 2016
@tobrun tobrun added the bug label Mar 31, 2016
@tobrun
Copy link
Member

tobrun commented Mar 31, 2016

When adding marker, I'm seeing these ids:

03-31 10:39:03.683 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: marker added with 6
03-31 10:39:06.421 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: marker added with 10
03-31 10:39:09.271 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: marker added with 11

When I inspect the first added marker with id 6, I'm seeing it has a value of 9.
When removing I'm seeing the following ids passed to core:

03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 0
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 1
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 2
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 3
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 4
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 5
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 6
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 10
03-31 10:39:21.524 15756-15756/com.mapbox.mapboxsdk.testapp V/TAG: 11

This is a regression from the fix in #4393.
Here you can see the issue in action, you should be able to see that the marker is multiple times added / removed because DID_FINISH_RENDERING_MAP_FULLY_RENDERED is called multiple times.

@tobrun
Copy link
Member

tobrun commented Mar 31, 2016

I found a fix for this by ensuring it's only called once without changing the event type,
So this won't impact the previous fix in #4393.

@vfaSonnt
Copy link
Author

Thank you very much! I checked, it is OK. Now I am waiting for next release. =)

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

Successfully merging a pull request may close this issue.

2 participants