Android Google Maps V2 - OnInfoWindowClick on several markers

前端 未结 3 1662
别跟我提以往
别跟我提以往 2020-12-17 03:43

I have the code to make one marker start a activity when you click on the infowindow. It works absolutely fine. But when I try to add in another marker and another @override

3条回答
  •  再見小時候
    2020-12-17 04:30

    For the Problem :

    Class is a raw type. References to generic type Class should be parameterized  
    

    i add < ? > next to Class:

    private Map> allMarkersMap = new HashMap>();
    

    and

    Class cls = allMarkersMap.get(marker);
    

    And if you already working in a fragment class (like happend to me) you will change:

    public void onInfoWindowClick(Marker marker) {
        Class cls = allMarkersMap.get(marker);
        Intent intent = new Intent(getActivity(), cls);
        startActivity(intent);
    }
    

提交回复
热议问题