1

円弧を描いたキャンバスで作成された画像のマップに GroundOverlay を表示していますが、いくつかの問題が発生しています。まず、しばらくするとアプリケーションがクラッシュします (Java .lang.OutOfMemoryError)、オーバーレイが表示されていません。オーバーレイの画像に白い背景を付けてみましたが、それが表示されるので、アークに問題があると思いますが、何が間違っていたのかわかりません。誰でも何か考えがありますか?

Projection projection = map.getProjection();

                    Point point1 = projection.toScreenLocation(latlng1);
                    Point point2 = projection.toScreenLocation(latlng2);

                    float startAngle = (float) (Math.atan2(point1.y - point2.y,
                            point1.x - point2.x));
                    float sweepAngle = (float) (GenericNdData.getLateralTrajectory(
                            T_FplnType.ACTIVE.getId()).getSegment(i).getAngle());

                    float radius = FloatMath.sqrt((float) (Math.pow(
                            (point1.x - point2.x), 2) + Math.pow(
                            (point1.y - point2.y), 2)));
                    RectF rectangle = new RectF(point2.x - radius, point2.y
                            - radius, point2.x + radius, point2.y + radius);

                    Paint paint = new Paint();

                    paint.setARGB(250, 0, 255, 0);
                    paint.setAntiAlias(true);
                    paint.setSubpixelText(true);
                    paint.setFakeBoldText(true);
                    paint.setStrokeWidth(4f * Configuration.General.getScreenFactor());

                    paint.setStyle(Paint.Style.STROKE);

                    Bitmap arc = Bitmap.createBitmap(500, 500, Bitmap.Config.ARGB_8888);

                    Canvas canvas = new Canvas(arc);
                    canvas.drawColor(0xFFFFFFFF);
                    canvas.drawArc(rectangle,
                            (float) (Math.toDegrees(startAngle)),
                            (float) (Math.toDegrees(sweepAngle)), false, paint);

                    GroundOverlay groundArc = map.addGroundOverlay(new GroundOverlayOptions()
                     .image(BitmapDescriptorFactory.fromBitmap(arc))
                     .position(latlng2, 10000));

前もって感謝します。

4

1 に答える 1

1

BitmapDescriptorFactory.fromBitmap()マーカーを使用した場合に関連する既知のメモリ リークの問題があります。ここで問題になるかもしれませんが、まず次のことを試してください。

GroundOverlay.remove()

を呼び出す前に、以前にオブジェクトを追加しましGoogleMap.addGroundOverlayた。

于 2013-04-22T09:49:05.837 に答える