androidgoogle-mapsandroid-mapviewitemizedoverlay

Moving icons on a Android MapView


I'm working on an application that displays the location of moving items on a Google MapView. I need a way to update the position of the icons that represent the items (as well as change the facing of the icons every two seconds as updated data comes in).

I currently have an activity in the app that extends MapActivity. On to this I have overlaid a static Overlay that draws some lines on the map and an ItemizedOverlay that draws a static icon.

There is a draw() method that claims to be used by animated overlays, but overriding it to do my animations still doesn't make anything animate.

Do I need to tell the app to make my overlay animate, or do I need to use a different type of overlay?


Solution

  • There are two things that I have in mind about your problem.

    First, did you consider using invalidate() on the MapView to force a redraw? That's probably not the most efficient solution, but it should at least get you something you can work from.

    Second, you can refresh the items on your map by calling the activity again. Here is an example.