내 응용 프로그램을 할당 할 수 없습니다하면 응용 프로그램에 과부하가되지 않도록 클러스터를 통해 표시되는지도에 약 1,500 마커가 있습니다. 이 책갈피는 BitmapDescriptorFactory.defaultMarker()로 현재 표시됩니다. BitmapDescriptorFactory.defaultMarker()로 표시되는 북마크는 0으로 표시됩니다. 표식에 값이있는 사용자 정의 비트 맵을 표시하도록 각 도트의 코드를 수정하면 일부 장치에만 LG K10 LTE 및 일부 Motorolas. 대부분의 어플라이언스는 정상적으로 작동합니다. 나는이 기능을 사용하면 내가 모두 1500 개 마커를 렌더링 완료하기 전에
, 그것은 다음과 같은 오류와 충돌 : ". DUP 방울의 FD를 할당 할 수 없습니다"
가
이 오류에 대한 연구에서, 이것은 메모리 오버 플로우이며 이러한 마커를 LRU 캐시에 저장해야한다는 것으로 보이지만 클러스터와 함께이 작업을 수행 할 수는 없습니다.
이 문제를 해결 한 사람이 있습니까? 아니면이 아이디어를 제안 했습니까? 다음
이비트 맵 렌더러 코드입니다 :
내가 제외한 모든 마커를 클러스터를 강제로 코드를 수정 또는
public class OwnRendring extends DefaultClusterRenderer<MyItem> {
OwnRendring(Context context, GoogleMap map, ClusterManager<MyItem> clusterManager) {
super(context, map, clusterManager);
}
protected void onBeforeClusterItemRendered(MyItem item, MarkerOptions markerOptions) {
markerOptions.snippet(item.getSnippet());
markerOptions.title(item.getTitle());
markerOptions.anchor(0.33f, 1f);
markerOptions.infoWindowAnchor(0.33f,0f);
int cor = (item.getPublico() ? cfgCorPostoPublico : cfgCorPostoPrivado);
String preço = item.getTitle().substring(item.getTitle().length() - 5);
markerOptions.icon(BitmapDescriptorFactory.fromBitmap(createMarker(preço, cor)));
super.onBeforeClusterItemRendered(item, markerOptions);
}
protected boolean shouldRenderAsCluster(Cluster cluster) {
return cfgCluster && cluster.getSize() >= cfgClusterMin;
}
}
@Override
public void onCameraIdle() {mClusterManager.cluster();}
private Bitmap createMarker(String text, int color) {
View markerLayout = getLayoutInflater().inflate(R.layout.custom_marker, null);
ImageView markerImage = markerLayout.findViewById(R.id.marker_image);
TextView markerRating = markerLayout.findViewById(R.id.marker_text);
markerImage.setImageResource(R.drawable.pin_shadow);
markerImage.clearColorFilter();
markerImage.getDrawable().mutate().setColorFilter(color, PorterDuff.Mode.MULTIPLY);
markerRating.setText(text);
markerLayout.measure(
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED),
View.MeasureSpec.makeMeasureSpec(0, View.MeasureSpec.UNSPECIFIED));
markerLayout.layout(0, 0, markerLayout.getMeasuredWidth(), markerLayout.getMeasuredHeight());
final Bitmap bitmap = Bitmap.createBitmap(
markerLayout.getMeasuredWidth(),
markerLayout.getMeasuredHeight(),
Bitmap.Config.ARGB_8888);
Canvas canvas = new Canvas(bitmap);
markerLayout.draw(canvas);
return bitmap;
}