I have to draw about 10000 line on Google Maps. So, it is spending too much time in draw() method. Moving on map becomes very laggy. Is there any way to cache drawing or can I draw just the part of map / canvas which is currently seen on screen?
I have to draw about 10000 line on Google Maps. So, it is spending
Share
Now I can draw all 10000 lines without any lag. It is all about designing
draw()method carefully. I moved some object creating operations (like Path, Point) out of draw(). I saw that especiallyprojection.toPixels(geoPoint, point);is very expensive operation. Finally I set an alpha constant which holds the pixel value of finger movement. And it only draws when pixelX or pixelY movement is bigger than alpha.