Polyline on user walking
<p>I'm trying to make a polyline in map from Android while the user walks Below is my code.But I just get a straight line from my current location to somewhere else.</p>

<p>public class Map extends MapActivity {</p>

<pre><code>private MapController mapController;
private MapView mapView;
private LocationManager locationManager;

private MyLocationOverlay myLocationOverlay;
 GeoPoint geoPoint = null;
 GeoPoint despoint = null;
 int latitude;
 int longitude;
 GeoPoint srcGeoPoint;
 public HelloItemizedOverlay routeOverlay;

public void onCreate(Bundle bundle) {
    super.onCreate(bundle);
    setContentView(R.layout.main2); // bind the layout to the activity
    mapView = (MapView) findViewById(R.id.mapview);
    mapView.setBuiltInZoomControls(true);
    mapView.setSatellite(false);
    mapController = mapView.getController();
    mapController.setZoom(14); // Zoon 1 is world view
    locationManager = (LocationManager) getSystemService(Context.LOCATION_SERVICE);
    locationManager.requestLocationUpdates(LocationManager.GPS_PROVIDER, 2000,
            2, new GeoUpdateHandler());
    Location location = locationManager.getLastKnownLocation(LocationManager.GPS_PROVIDER);
     if(location != null)                                
        {
             latitude = (int) (location.getLatitude() * 1E6);
            longitude = (int) (location.getLongitude() * 1E6);
        }  
      srcGeoPoint = new GeoPoint(latitude, latitude); 
      geoPoint = srcGeoPoint;
    myLocationOverlay = new MyLocationOverlay(this, mapView);
    mapView.getOverlays().add(myLocationOverlay);
    mapView.getController().setZoom(15);
    //mapController.setCenter(geoPoint);
    //mapView.getOverlays().add(new HelloItemizedOverlay(srcGeoPoint, srcGeoPoint));

}

@Override
protected boolean isRouteDisplayed() {
    return false;
}

public class GeoUpdateHandler implements LocationListener {



    @Override
    public void onLocationChanged(Location location) {

        int lat = (int) (location.getLatitude() * 1E6);
        int lng = (int) (location.getLongitude() * 1E6);
        GeoPoint changepoint = new GeoPoint(lat, lng); 




        mapView.getOverlays().add(new HelloItemizedOverlay(srcGeoPoint,changepoint));




    }

    @Override
    public void onProviderDisabled(String provider) {
    }

    @Override
    public void onProviderEnabled(String provider) {
    }

    @Override
    public void onStatusChanged(String provider, int status, Bundle extras) {
    }
}



@Override
protected void onResume() {
    super.onResume();
    myLocationOverlay.enableMyLocation();
    myLocationOverlay.enableCompass();
}

@Override
protected void onPause() {
    super.onResume();
    myLocationOverlay.disableMyLocation();
    myLocationOverlay.disableCompass();
}
</code></pre>

<p>}
 Overlay class</p>

<p>public class HelloItemizedOverlay extends Overlay {</p>

<pre><code> private GeoPoint gp1;
    private GeoPoint gp2;

public HelloItemizedOverlay(GeoPoint gp1, GeoPoint gp2) {
    this.gp1 = gp1;
    this.gp2 = gp2;
}
@Override
public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
        long when) {
     Projection projection = mapView.getProjection();
        if (shadow == false) {

            Paint paint = new Paint();
            paint.setAntiAlias(true);
            Point point = new Point();
            projection.toPixels(gp1, point);
            paint.setColor(Color.BLUE);
            Point point2 = new Point();
            projection.toPixels(gp2, point2);
            paint.setStrokeWidth(2);
            canvas.drawLine((float) point.x, (float) point.y, (float) point2.x,
                    (float) point2.y, paint);
        }
        return super.draw(canvas, mapView, shadow, when);
    }
</code></pre>

<p>}</p>

<p>Can anyone pls help me out to draw a line on user walks.The above just draw a line from current loc to some where</p>
