Take the 2-minute tour ×

Here's my problem, I've a list 0...n-1. In this list I've n overlays. I need to simulate a mooving car on the map, which is rappresented by the overlay. I tryed to do an AsyncTask which spawn the overlays on the main thread, but when I drag the mapview it crashes with currentmodificationexception. This is a iterator's problem, because I can't manage any overlay from other threads. How can I do?

share|improve this question

1 Answer 1

Instead of using n overlays, you can use only one overlay and override the draw method to draw the car in the correct position.

You can still use the async task to define the car position (x,y), and in the overlay draw you use this X,Y coordinate to position the car.


public class CarOverlay extends Overlay {
set(intx, int y){
  this.x = x;
  this.y = y;

public void draw(Canvas canvas, MapView mapview, boolean shadow) {
  darwCar(x,y); //you need to create your darwCar method ...

good luck.

share|improve this answer
Ty man it works! –  Meesta Oct 6 '12 at 21:36

Your Answer


