+1  A: 

I have only used ItemizedOverlay, not Overlay, so these suggestions are pure conjecture. Heck, I haven't even done much with the 2D graphics API.

Obviously, the best answer is to get it to stop calling draw() all the time. Try logging some stack traces and see if you can figure out what is triggering all of the draw() calls. For example, in the Android Google Groups recently, somebody noticed that Chronometer causes widgets in the same UI to be redrawn every second. While I can see you don't have a Chronometer, you might be able to figure out some root cause to the draw() calls that you can correct.

Assuming that does not help, I am guessing that the test for "whether anything has changed or not" is some combination of getLatitudeSpan(), getLongitudeSpan(), getZoomLevel(), and maybe other MapView methods. And, I am assuming that on every draw() you are iterating over your GPS points and drawing the route. If so, you could try:

  1. When you really do draw, draw first to a Canvas backed by a Bitmap, then apply the Bitmap on the Canvas you are handed in draw(), and cache that Bitmap.
  2. Track what combination of values were used in the last draw(), and if the next draw() is the same, just reuse the existing Bitmap. Else, go to step #1, making sure to release the Bitmap (or reuse it, if that's possible).

I am guessing that with graphics acceleration, blasting a Bitmap onto the Canvas is cheaper than iterating over the coordinates and drawing lines. And, by caching the Bitmap, you will save on garbage generation.

Anyway, just a thought.

CommonsWare
Yeah... I'd thought about going the reusable Bitmap route... it just sounded like work :) I'll see if I can figure out why it's constantly redrawing. I was kinda wondering if it was just what MapView did, or if I was having issues. Clearly I need to do more testing.
fiXedd
A: 

Hi,I have the same problem. I want to connect many(more than 1000) coordinates to draw some routes. The coordinates are read from database. I add many overlay. It works but very slowly.I noticed you posted this thread on 2009, so maybe now you have solved this problem. If so please send me some information. Thank you very much!

vmbai