yandex / mapkit-android-demo

MapKit Android demo
Other
121 stars 59 forks source link

Failed to remove MapObject #81

Closed abdlkdrisiktan closed 5 years ago

abdlkdrisiktan commented 5 years ago

I try to remove PlaceMarkObject with 2 way the first one is :>yandexMap.getMap().getMapObjects().addCollection().remove(object) second :> yandexMap.getMap().getMapObjects().remove(object) these methods are not working properly I don't know why here is the exception log : java.lang.RuntimeException: Failed to remove MapObject at com.yandex.mapkit.map.internal.MapObjectCollectionBinding.remove(Native Method)

Yandex Version -- 3.3.1

Can you help me ? Any help would be appreciated

vbazhenov commented 5 years ago

This error message means that you are trying to remove placemark from wrong collection. You can try to use this snippet:

object.getParent().remove(object);
abdlkdrisiktan commented 5 years ago

Thanks a lot @vbazhenov :+1: