Hi,
In my android application I use this method in "draw" Overlay class for draw route on map.
Can someone tell me if this method is good (in terms of performance) for route draw on map or I must to put code in Thread ??
I'm new to android.
`
public synchronized void draw(Canvas canvas, MapView mapView, boolean shadow) {
if (pointsAndTimes.isEmpty()) {
return;
} Projection projection = mapView.getProjection(); Paint paint = new Paint(); paint.setARGB(250, 255, 0, 0); paint.setAntiAlias(true); paint.setFakeBoldText(true); paint.setStrokeWidth(4); paint.setAlpha(100);
for (int i = 0; i < pointsAndTimes.size(); i++) { PointAndTime pointAndTime = pointsAndTimes.get(i); Point point = projection.toPixels(pointAndTime.getGeoPoint(), null);
if (i == pointsAndTimes.size() - 1) {
} else { PointAndTime nextPointAndTime = pointsAndTimes.get(i + 1);
Point nextPoint = projection.toPixels(nextPointAndTime
.getGeoPoint(), null);
canvas.drawLine(point.x, point.y, nextPoint.x, nextPoint.y,
paint);
}
} mapView.invalidate();
}`
Thanks