1
지도에 마커로 사용하고있는 DefaultClusterRenderer 클래스와 자체 ClusterItem이 있습니다. MarkerOptions를 사용하여 제목과 스 니펫을 설정하므로 내 onInfoWindowClick 이벤트에서 해당 항목을 가져올 수 있습니다. 새로운 Activity를 시작하고, 사용자가 클릭 한 infoWindow에 따라 다르지만, MarkerOptions에 태그를 추가 할 수 없기 때문에 Marker 매개 변수를 통해 onInfoWindowClick 메소드에서 태그를 가져올 수 없습니다.MarkerOptions .tag not available
각 ClusterItem에 id를 추가하고 onInfoWindowClick의 Marker를 통해 ID를 얻는 좋은 해결책을 찾고 있습니다.
public class OwnClusterRendering extends DefaultClusterRenderer<GeoPoint> {
private GoogleMap map;
public OwnClusterRendering(Context context, GoogleMap map, ClusterManager<GeoPoint> clusterManager) {
super(context, map, clusterManager);
this.map = map;
}
protected void onBeforeClusterItemRendered(GeoPoint geoPoint, MarkerOptions markerOptions) {
markerOptions.icon(geoPoint.getIcon());
markerOptions.snippet(geoPoint.getSnippet());
markerOptions.title(geoPoint.getTitle());
super.onBeforeClusterItemRendered(geoPoint, markerOptions);
}
}
MyCustomWindowAdapter :
@Override
public void onInfoWindowClick(Marker marker) {
Log.d("test", marker.getTitle());
Log.d("test", marker.getSnippet());
Log.d("test", marker.getId());
Log.d("test", String.valueOf(marker.getTag()));
// Intent intent = new Intent(context, StoneInfoSliderActivity.class);
// context.startActivity(intent);
}