How to set tag to Google Map's marker in Android?

前端 未结 3 1588
傲寒
傲寒 2021-02-03 22:12

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

3条回答
  •  无人及你
    2021-02-03 22:46

    Now You can do like this

    Update your google play service version to

    com.google.android.gms:play-services:9.4.0
    
    Marker marker=mMap.addmarker(new MarkerOptions(LatLang));
    // set object as tag
    marker.setTag(your object)
    
    // to retrieve the marker
    marker.getTag();// Type cast to your object type;
    

提交回复
热议问题