2017-04-14 1 views
0

Skobbler Map을 사용하여 Android 앱을 개발 중입니다.Skobbler Map (Android)의 사용자 정의 주석이 너무 많아 응답하지 않습니다.

내 앱에서 커스텀 어노테이션 (png 핀)을 많이 표시하고 싶습니다. 특수 효과의 수는 500 개를 넘으며 다양한 상황에서 핀 이미지가 변경됩니다. 사용자 정의 주석을 추가 할 수 있지만 주석이 렌더링 될 때 응용 프로그램이 10 초 이상 반응하지 않습니다 (주석을 추가하는 데 1 초도 걸리지 않지만 렌더링에는 약 10 초가 소요됨 - 전화에는 3GB RAM이 있음) .

여기서 다음과 같은 결과가 동일하고, 해당 코드

private void addAnnotations(List<Item> itemList) { 
    for (Item item : itemList) { 
     int itemId = item.getItemId(); 
     SKAnnotation annotation = new SKAnnotation(itemId); 
     annotation.setLocation(new SKCoordinate(item.getLatitude(), item.getLongitude())); 
     //annotation.setAnnotationType(SKAnnotation.SK_ANNOTATION_TYPE_RED); 

     SKAnnotationView annotationView = new SKAnnotationView(); 
     RelativeLayout customView = (RelativeLayout) ((LayoutInflater)getActivity().getSystemService(Context.LAYOUT_INFLATER_SERVICE)).inflate(
         R.layout.layout_custom_pin, null, false); 
     annotationView.setView(customView); 
     annotationView.setReuseIdentifierWithId("cat." + item.getCategoryId()); 
     annotation.setAnnotationView(annotationView); 

     mapView.addAnnotation(annotation, SKAnimationSettings.ANIMATION_NONE); 
    } 
} 

I가 초기에 상기 코드 '있는 CustomView'를 작성하여 멤버 변수에 저장하고 재사용하는 경우

이다.

미리 정의 된 주석 유형으로 setAnnotationType을 호출하여 일반 핀을 사용하는 경우 매우 빠릅니다. Skobbler는 내가했던 동일한 ID로 setReuseIdentifierWithId를 사용할 것을 제안합니다. 그 방법을 어디에서 어떻게 사용해야하는지 잘 모르겠습니다. 필자의 경우 "item.getCategoryId()"는 목록의 모든 항목에 대해 동일한 값을 반환합니다.

아무도 도와 줄 수 있습니까?

+0

해결책을 찾으십니까? – necatievrenyasar

답변

0

이 문제를 해결하는 데 사용되었습니다. 그러나 SDK 3.0.3 (Skobbler 팀의 최신 버전)을 사용하여 주석을로드 할 수있었습니다. 그러나 안드로이드 모니터에 경고가있을 것입니다. 그래서 나는 AsyncTask, progress bar로 함수를 옮겼다. 그것은 더 잘 작동합니다. 약 2 초? 그리고 경고 메시지도 없습니다.

관련 문제