-2

I am creating a map application using GoogleMap. I have a problem while moving a CustomMarker from first to second location with help of location change listener. CustomMarker gets duplicated because its maintaining the older position as well while updating to new location. Please refer the below image.

Duplication of single custom marker

DawidJ
  • 1,245
  • 12
  • 19
  • Are you using some kind of custom drawable and cloning it? If yes, then don't use clone. – Rahul Jan 22 '19 at 14:12
  • You can try [this nice code](https://stackoverflow.com/a/13912034/1507512) to move the marker without removing it – Massimo Jan 22 '19 at 14:47

1 Answers1

-1

Why won't you just clear() GoogleMap in order to remove old marker?

https://developers.google.com/android/reference/com/google/android/gms/maps/GoogleMap.html#clear()

DawidJ
  • 1,245
  • 12
  • 19