Reputation: 3834
I am going crazy! I add some markers and I save the id's of that markers in an Array. Later, I am using getInfoWindow(Marker marker)
from my custom implementation of InfoWindowAdapter
but the Marker in the parameter is not in the list I saved! Does the API copy the marker to pass it to getInfoWindow
? How can I know which marker is?
Upvotes: 1
Views: 136
Reputation: 1007533
Does the API copy the marker to pass it to getInfoWindow?
Yes. More specifically, Marker
instances are not retained by the library. They are used solely for IPC over to the Play Services Framework app and back again. Hence, the Marker
that you get back is a copy of the Marker
that you created.
How can I know which marker is?
Option #1: Use the snippet
portion of the Marker
to hold some identifier that you can map back to your data model, such as a key to a HashMap
Option #2: Use a library that does something akin to Option #1 for you, such as Android Map Extensions
Upvotes: 4