public void searchShelter() {
ShelterApi parser = new ShelterApi();
MapPoint mappoint = null;
System.out.println(“쉘터API 객체 만든후”);
ArrayList list = null;
ArrayList list2=null;
try {
System.out.println("api파서서치 호출전 ");
list = parser.Search(edit_address);
System.out.println("api파서서치 호출후");
HashSet<mapPoint> list1 = new HashSet<mapPoint>(list);
list2 = new ArrayList<mapPoint>(list1);
} catch (Exception e) {
e.printStackTrace();
}
for (mapPoint entity : list2) {
int i=0;
System.out.println("폴문시작");
System.out.println("마커옵션객체생성");
entity.getLatitude();
entity.getLongitude();
entity.getName();
entity.getrddr();
mappoint = MapPoint.mapPointWithGeoCoord(entity.getLatitude(), entity.getLongitude());
marker.setItemName("시설명 : "+entity.getName()+"\n상세주소 : "+entity.getrddr()+"\n시설면적 : "+entity.getfclty_ar()+
"\n 전화번호 : "+entity.getMngps_telno());
System.out.println("마커위치설정 : " + entity.getLatitude() + " , " + entity.getLongitude());
marker.setTag(i);
marker.setMapPoint(mappoint);
marker.setMarkerType(MapPOIItem.MarkerType.BluePin); // 기본으로 제공하는 BluePin 마커 모양.
marker.setSelectedMarkerType(MapPOIItem.MarkerType.RedPin); // 마커를 클릭했을때, 기본으로 제공하는 RedPin 마커 모양.
// marker.setShowDisclosureButtonOnCalloutBalloon(false);
// marker.getCustomCalloutBalloon();
// mMapView.addPOIItem(marker);
i++;
mMapView.setMapCenterPoint(mappoint,true);
mMapView.setZoomLevel(7,true);
mMapView.setPOIItemEventListener(this);
mMapView.addPOIItem(marker);
}
}
이벤트 리스너를 mMapView 라는 객체에 등록하는데
마지막으로 등록된 마커에만 이벤트 등록이 됩니다.
Web버전에서 같은글을 보았는데 안드로이드에선 어떻게 적용해야할지 궁금합니다 ㅠ