I\'m trying to set onInfoWindowClickListener for each marker that hit the related API according to the POJO id. That\'s what I found for settin
Try to call setTag() method on map marker, not on the MarkerOptions object for.e.g.,
private void addMk(LatLng latLng, String title, String snips,String tagId) {
MarkerOptions options = new MarkerOptions()
.position(latLng)
.title(title)
.snippet(snips);
googleMap //Google googleMap object for map reference
.addMarker(options)
.setTag(tagId);
}
googleMap.setOnInfoWindowClickListener(new OnInfoWindowClickListener() {
@Override
public void onInfoWindowClick(Marker marker) {
// TODO Auto-generated method stub
String tagId= String.valueOf(marker.getTag());
Log.d(TAG, "onInfoWindowClick: TAG_ID "+tagId);
}
});
Hope, this works!