Android cluster and marker clicks

前端 未结 4 2015
执笔经年
执笔经年 2020-12-03 05:56

I\'m using the android clustering utility on a map and succesffuly implemented an onclick listener with mClusterManager.setOnClusterItemClickListener() for all the markers h

4条回答
  •  难免孤独
    2020-12-03 06:20

    One more way to receive the click event for Marker is using OnClusterItemClickListener interface.

    Call mClusterManager.setOnClusterItemClickListener(this); and make your class implement OnClusterItemClickListener

    Then inside the onClusterItemClick method, you will get the ClusterItem which is the marker that was clicked,

    @Override
    public boolean onClusterItemClick(ClusterItem clusterItem) {
    
        Toast.makeText(getActivity(), "Latitude " + clusterItem.getPosition().latitude, Toast.LENGTH_LONG).show();
    
        return true;
    }
    

提交回复
热议问题