0
내 앱에지도에 오버레이가 많이 있습니다. 어떻게지도가 너무 느리게 지켜 지나요? 지도 위에서 돌아 다니면 5 초 정도 지연됩니다. 사람들을 추가하는 방법에 대한 내 코드를 살펴보고 누군가가 나에게이 문제를 해결하는 방법을 보여줄 수 있도록하여 너무 느리지 않도록지도에 약 80 개의 오버레이가 있고 두 번째 오버레이로 성장합니다. mapOverlays.add (otherslocation)는 루프의 내부에 왜많은 오버레이가 추가 된 후 android지도가 느리게 움직입니다.
ArrayList<String> lstotherslocation = MyGlobalInfomation.getOthersLocation();
List<Overlay> mapOverlays = gMapView.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.otherslocation);
OthersLocationOverlay otherslocation = new OthersLocationOverlay(drawable,this);
mapOverlays.clear();
for(int i = 0; i < lstotherslocation.size();i++){
number = number + 1;
OthersPoint = new GeoPoint((int) (Double.parseDouble(lstotherslocation.get(i).trim())),
(int) (Double.parseDouble(lstotherslocation.get(i + 1).trim())));
OverlayItem overlayitem = new OverlayItem(OthersPoint, "Title",
"test: " + lstotherslocation.get(i+ 2) + "\n" +
"User: " + lstotherslocation.get(i+ 3) + "\n" +
"test: " + lstotherslocation.get(i+ 4) + "\n" +
"test: " + lstotherslocation.get(i+ 5));
i = i + 5;
otherslocation.addOverlay(overlayitem);
mapOverlays.add(otherslocation);
예, 내 코드와 비교하여 코드에서 수행 할 작업을 확신 할 수 없습니다. 내지도에는 아주 느린 시간이 있습니다. – user516883
for 루프 내에 mapOverlays.add (다른 위치)가 없습니까? for 루프에서 제외하고 다른 위치 만 포함하십시오. 루프에서 – ddewaele
안녕하세요 ..이 문제를 해결 했나요? 나도 똑같은 문제에 직면 해 있습니다. 해결책이 있다면 제게 안내해주십시오. –