title: Android google maps drawing roads performanse issue with 10.000+ overlay
body: <p>I am working on a project which is aboot drawing roads and displaying some informations about the roads. The issue is that  I am using so many geopoints( 5.000-10.000 +) and drawing line points to points and showing the roads with different colors, <strong>so the map is too slow.</strong> I did some configurations about my application but still too slow. 
  Do you have any idea about solving my problem and being the performance  better?</p>
  
  <p>Here is the my code.</p>
  
  <pre><code>for (int t = 0; t &lt; roads.size(); t++) {
  
              for (int i = 0; i &lt; roads.get(t).size() - 1; i++) {
                                  //bounds up-bottom-right-left to draw roads
                  if (boundBox[0] &gt;= roads.get(t).get(i)
                          .getLatitudeE6()
                          &amp;&amp; boundBox[1] &gt;= roads.get(t).get(i)
                                  .getLongitudeE6()
                          &amp;&amp; boundBox[2] &lt;= roads.get(t).get(i)
                                  .getLatitudeE6()
                          &amp;&amp; boundBox[3] &lt;= roads.get(t).get(i)
                                  .getLongitudeE6()) {
  
  
                      MyOverlay mOverlay = new MyOverlay();
                      mOverlay.setColor(Color.GREEN);
  
                      mOverlay.setWidth(4);
                      mOverlay.setPair(roads.get(t).get(i),
                              roads.get(t).get(i + 1));
                      mapOverlays.add(mOverlay);
                  }
              }
          }
  </code></pre>
  
  <hr>
  
  <pre><code> class MyOverlay extends Overlay {
  
              GeoPoint gp1 = new GeoPoint(0, 0);
              GeoPoint gp2 = new GeoPoint(0, 0);
              int colr=0,width=0;
  
  
  
              public MyOverlay() {
  
              }
  
              public void draw(Canvas canvas, MapView mapv, boolean shadow) {
                  super.draw(canvas, mapv, false);
  
                  Paint mPaint = new Paint();
                  mPaint.setDither(true);
                  mPaint.setColor(colr);
                  mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
                  mPaint.setStrokeJoin(Paint.Join.ROUND);
                  mPaint.setStrokeCap(Paint.Cap.ROUND);
                  mPaint.setStrokeWidth(width);
  
                  Point p1 = new Point();
                  Point p2 = new Point();
  
                  Path path = new Path();
  
                  Projection projection = mapv.getProjection();
                  projection.toPixels(gp1, p1);
                  projection.toPixels(gp2, p2);
  
                  path.moveTo((float) p2.x, (float) p2.y);
                  path.lineTo((float) p1.x, (float) p1.y);
  
  
                  // canvas.drawBitmap(markerBitmap, point.x, point.y, null);
  
                  canvas.drawPath(path, mPaint);
                  //canvas.drawBitmap(bitmap, src, dst, paint);
  
              }
  
              public void setPair(GeoPoint gpone, GeoPoint gptwo) {
  
                  gp1 = gpone;
                  gp2 = gptwo;
  
              }
  
              public void setColor(int clr)
              {
                  colr=clr;
              }
  
              public void setWidth(int w)
              {
                  width=w;
              }
  
  
          }
  </code></pre>
  
  <p>Is there anyone to solve my issue ?</p>