HashMap 또는 이와 유사한 것을 사용하는 것이 좋습니다. 당신이 객체의 목록을 반복하고 그들을위한 마커를 만들 때, 또한 키와 객체의 ID를 사용하여 목록에 마커를 추가하고 값으로 마커 :
private HashMap<Integer, Marker> markerMap = new HashMap<Integer, Marker>();
...
for(MarkerObject obj : this.markerObjects)
{
//If the marker isn't already being displayed
if(!markerMap.containsKey(obj.getId()))
{
//Add the Marker to the Map and keep track of it
this.markerMap.put(obj.getId(), this.mMap.addMarker(getMarkerForObject(obj)));
}
}
그런 다음 당신은 당신의지도에 도청 마커의 개체 ID를 찾을 수 및 세부 사항을 열고 새로운 활동과 같은 해당 데이터 뭔가를 할 수있는 OnInfoWindowClickListener를 사용할 수 있습니다.
안녕 이 질문은 다른 질문과 관련이 있습니다 (http://stackoverflow.com/questions/14318258/how-google-maps-android-api-v2-handle-markers-outside-the-view-are/14323819#14323819). 당신도 대답했습니다. HashMap에있는 항목의 수를 제어하는 방법에 대해 걱정하고 있으며 표시 영역에없는 항목을 제거하고 싶습니다. 너는 무엇을 제안 하는가? –
나는이 블로그 포스트에서 쓴 것과 비슷한 것을 제안한다. http://discgolfsoftware.wordpress.com/2012/12/06/hiding-and-showing-on-screen-markers-with-google-maps- android-api-v2/ – DiscDev
[MapFragment documentation] (https://developers.google.com/maps/documentation/android/reference/com/google/android/gms/maps/MapFragment)에 대한 경고를 무시하지 않습니까?) 페이지에서 GoogleMap 객체를 유지할 수 있습니까? – WeNeigh