2011-04-19 2 views
1

Google지도에서 DB의 장소/상점 앱을 개발 중이며 500 개 이상의 마커가 있습니다.500 개 이상의 마커를 추가하면 앱이 걸려 있습니다.

나는 곳 2 종류의이 같은 가게의 한 종류 추가 : 이것은 잘 작동하고, 모든 마커가 표시됩니다

Cursor places = db.getAllPlaces(); 
    this.placeMarker0 = new ItemizedMarker(this.getResources().getDrawable(
      R.drawable.place0), this); 
    this.placeMarker1 = new ItemizedMarker(this.getResources().getDrawable(
      R.drawable.place1), this); 
    this.shopMarker = new ItemizedMarker(this.getResources().getDrawable(
      R.drawable.shop), this); 
    if (places.moveToFirst()) { 
     do { 
      String[] coordinates = places.getString(11).split(","); 
      if (coordinates.length > 0) { 
       GeoPoint point = new GeoPoint((int) (Double 
         .parseDouble(coordinates[0]) * 1E6), (int) (Double 
         .parseDouble(coordinates[1]) * 1E6)); 
       OverlayItem overlayitem = new OverlayItem(point, places 
         .getString(1), Integer.toString(places.getInt(0))); 
       if (places.getInt(12) == 0) { 
        placeMarker0.addMarker(overlayitem); 
       } else if (places.getInt(12) == 1) { 
        placeMarker1.addMarker(overlayitem); 
       } else { 
        shopMarker.addMarker(overlayitem); 
       } 
      } else { 
       Log.w("GMaps", "Place not located - " + places.getString(1)); 
      } 
     } while (places.moveToNext()); 
     this.placeMarker0.populateNow(); 
     this.mapOverlays.add(placeMarker0); 
     this.placeMarker1.populateNow(); 
     this.mapOverlays.add(placeMarker1); 
     this.shopMarker.populateNow(); 
    } 

(기본값으로하지 상점 :-)하지만) 문제는 모든 마커를 추가 한 후 앱이 자주 정지되고 마커를 클릭하거나 잠시 동안지도를 집거나 확대/이동할 수 없다는 점입니다. ZoomControls가 추가되어 작동하지만지도와 직접 상호 작용하지 않습니다.

Android Google지도 API가 여러 마커를 처리하지 못하거나 다른 접근 방식을 사용해야합니까?

자세한 내용이 필요하면 알려주세요.

답변

0

500 개 이상의 개별 마커를 만드는 대신 Marker Clusters을 사용하셨습니까? 성능 오버 헤드 외에도 현재 설정이 사용자를 압도 할 수 있습니다.

+0

멋진 라이브러리처럼 보입니다. 감사! 나는 가까운 시일 내에 그것을 시도 할 것이다! – Smet

관련 문제