Making a marker carry custom info to be used when clicked (Android, Google Maps v2)

后端 未结 2 1159
北恋
北恋 2020-12-22 03:18

I have the following code:

public class AlertViewOnMap extends Activity {

    //declarations
    ArrayList dateCreatedAtList = new ArrayList&l         


        
2条回答
  •  有刺的猬
    2020-12-22 04:02

    To asnwer your question: it doesn't seem like Marker allows any 'set' methods like View's tag as per here

    I think Haresh's solution is the generally right one.

    I'd just make the following correction to the following method:

    public GoogleMap.OnMarkerClickListener getInfoMarkerClickListener()
    

    The line:

     alertTimeTextView.setText(dateCreatedAtList.get(alert.getId()));
    

    should be :

     alertTimeTextView.setText(alert.getCreatedAt());
    

提交回复
热议问题