title: GPS traking (draw line as the user move on google map)
body: <p>I'm trying to to display google map and draw a line as the user walk (Gps traking app)
  I've 2 problems:
  1- the map doesn't show up (only the grid of the map shows)
  2-I'm saving the Geopoints in a list as the user walk (and i can actually see the dot indicating my location on the map moves!) but no line is drawn connecting them.
  Could you check my code below and advice?</p>
  
  <p>extra Q: do I have to write Myoverly on a separate java file cause at the moment I have one file with this code on? is it necessiry to choose google api instead of the standard for my app to run well?</p>
  
  <pre><code>package com.example.geoart;
  
  public class HelloGoogleMaps2 extends MapActivity implements LocationListener {
  
  
   LocationManager locman;
    LocationListener loclis;
    Location Location;
    public  MapView map;
  
      List&lt;GeoPoint&gt; geoPointsArray = new ArrayList&lt;GeoPoint&gt;();
       private MapController controller;
      String provider = LocationManager.GPS_PROVIDER;
     double lat;
     double lon;
  
   @Override
     public void onCreate(Bundle savedInstanceState) {
  super.onCreate(savedInstanceState);
  setContentView(R.layout.main);
  initMapView();
  initMyLocation();
  locman = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
  // locman.requestLocationUpdates(provider,60000, 100,loclis);
  // Location = locman.getLastKnownLocation(provider);
  
   }
  
    /*  Find and initialize the map view. */
  private void initMapView() {
  map = (MapView) findViewById(R.id.mapview);
  controller = map.getController();
  map.setSatellite(false);
  map.setBuiltInZoomControls(true);
   }
  
   /** Find Current Position on Map. */
    private void initMyLocation() {
    final MyLocationOverlay overlay = new MyLocationOverlay(this, map);
   overlay.enableMyLocation();
  //overlay.enableCompass(); // does not work in emulator
  overlay.runOnFirstFix(new Runnable() {
      public void run() {
          // Zoom in to current location
          controller.setZoom(24);
          controller.animateTo(overlay.getMyLocation());
      }
  });
  map.getOverlays().add(overlay);
     }
  
    @Override
     public void onLocationChanged(Location location) {
     if (Location != null) {
      lat = Location.getLatitude();
      lon = Location.getLongitude();
      GeoPoint New_geopoint = new GeoPoint((int) (lat * 1e6),
              (int) (lon * 1e6));
      geoPointsArray.add(New_geopoint); //add geopoints to my array//
      controller.animateTo(New_geopoint);
  
       }
  
    }
  
        class MyOverlay extends Overlay {
     public MyOverlay() {
       }
  
         public void draw(Canvas canvas, MapView mapv, boolean shadow) {
        super.draw(canvas, mapv, shadow);
  
      Projection projection = map.getProjection();
      Path p = new Path();
      for (int i = 0; i &lt; geoPointsArray.size(); i++) {
          if (i == geoPointsArray.size() - 1) {
              break;
          }
          Point from = new Point();
          Point to = new Point();
          projection.toPixels(geoPointsArray.get(i), from);
          projection.toPixels(geoPointsArray.get(i + 1), to);
          p.moveTo(from.x, from.y);
          p.lineTo(to.x, to.y);
      }
      Paint mPaint = new Paint();
  
      mPaint.setDither(true);
      mPaint.setColor(Color.RED);
      mPaint.setStyle(Paint.Style.FILL_AND_STROKE);
      mPaint.setStrokeJoin(Paint.Join.ROUND);
      mPaint.setStrokeCap(Paint.Cap.ROUND);
      mPaint.setStrokeWidth(2);
  
     /*mPaint.setStyle(Style.STROKE);
      mPaint.setColor(0xFFFF0000);
      mPaint.setAntiAlias(true);
      canvas.drawPath(p, mPaint);*/
      super.draw(canvas, map, shadow);
  }
  }
  
      @Override
     public void onProviderDisabled(String provider) {
    // TODO Auto-generated method stub
  
    }
  
   @Override
      public void onProviderEnabled(String provider) {
       // TODO Auto-generated method stub
  
        }
  
       @Override
       public void onStatusChanged(String provider, int status, Bundle extras) {
       // TODO Auto-generated method stub
  
      }
  
         @Override
         protected boolean isRouteDisplayed() {
         // TODO Auto-generated method stub
        return false;
      }
             }
  </code></pre>
  
  <p>My main.Xml code </p>
  
  <pre><code>     &lt;?xml version="1.0" encoding="utf-8"?&gt;
         &lt;com.google.android.maps.MapView
   xmlns:android="http://schemas.android.com/apk/res/android"
   android:id="@+id/mapview"
   android:layout_width="fill_parent"
   android:layout_height="fill_parent"
   android:clickable="true"
   android:apiKey="AIzaSyD2epTuEtf-L_UFtQ_7vtQKQdJJ3hMA5YM"
  
  
  /&gt;
  </code></pre>