title: How to display a moving track on Android device
body: <p>I want to plot my track using GPS on an Android device.</p>
  
  <p>I have no problem displaying a completed route but am finding it difficult to show the track as I'm moving.</p>
  
  <p>So far, I've found 2 different ways to do that but neither are particularly satisfactory.</p>
  
  <h1>METHOD 1</h1>
  
  <pre><code>PolylineOptions track = new PolylineOptions();
  Polyline poly;
  
  while (moving) {
      Latlng coord = new LatLng(lat,lng);    // from LocationListener
      track.add(coord);
      if (poly != null) {
          poly.remove();
      }
      poly = map.addPolyline(track);
  }
  </code></pre>
  
  <p>ie build up the polyline removing it before adding the new coordinates and then adding it back.</p>
  
  <p>This is horrendously slow.</p>
  
  <h1>METHOD 2</h1>
  
  <pre><code>oldcoord = new LatLng(lat,lng);;
  
  while (moving) {
      PolylineOptions track = new PolylineOptions();
      LatLng coord = new (LatLng(lat,lng);
      track.add(oldcoord);
      track.add(coord);
      map.addPolyline(track);
  
      oldcoord = coord;
  }
  </code></pre>
  
  <p>ie plot a series of single polylines.</p>
  
  <p>Whilst this renders a lot faster than Method 1, it looks quite jagged, particularly at lower zoom levels because each polyline is squared off and it is only the corners that actually touch.</p>
  
  <p>Is there a better way and, if so, what is it?</p>