basically when adding a marker to the map it returns the new marker and you can gets the marker id from it like so
Marker m = map.addMarker(new MarkerOptions
Use WeakHashMap to store markers because in this way, we wouldn't keep a reference to a Marker in memory, and wouldn't have to worry about garbage collected markers.
secondly recommended way to do this is to have a WeakHashMap with ID and your custom data. The documentation says that marker object may change, so don't use the marker as the key. if the activity is killed and restored but the ID will remain the same. sometime it may return null also if marker objects changed.
WeakHashMap obj = new WeakHashMap ();
Hope it will help future viewers...