User place the marker anywhere and the initial marker will disappear
<p>I followed one of the example that people gave me. I have got a marker pin at my current location and also a map is shown. Right now i want to let the user place the marker(pushpin) anywhere he/she likes and the initial marker(pushpin) will disappear after the user pin on other place. Can anyone help?</p>

<pre><code>mapView = (MapView) findViewById(R.id.mapview);
        mapView.setBuiltInZoomControls(true);
        mc = mapView.getController();

        // obtain gps location
        lm = (LocationManager)
            getSystemService(Context.LOCATION_SERVICE);

        locationListener = new MyLocationListener();
    lm.requestLocationUpdates(
        //  LocationManager.GPS_PROVIDER,
            LocationManager.NETWORK_PROVIDER,   
            0,
            0,
            locationListener);
}

private class MyLocationListener implements LocationListener
{

    public void onLocationChanged(Location loc) {
        if (loc != null) {
            Toast.makeText(getBaseContext(), 
                    "Location changed: Lat: " + loc.getLatitude() +
                    " Lng: " + loc.getLongitude(),
                    Toast.LENGTH_SHORT).show();
        }   
        p = new GeoPoint(
                (int) (loc.getLatitude() * 1E6),
                (int) (loc.getLongitude() * 1E6));
        mc.animateTo(p);
        mc.setZoom(18);

        // Add a location marker
        MapOverlay mapOverlay = new MapOverlay();
        List&lt;Overlay&gt; listofOverlays = mapView.getOverlays();
        listofOverlays.clear();
        listofOverlays.add(mapOverlay);

        // invalidate() method forces the MapView to be redrawn
        mapView.invalidate();
    }

    public void onProviderDisabled(String provider){
    }

    public void onProviderEnabled(String provider){
    }

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

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

class MapOverlay extends com.google.android.maps.Overlay {
    @Override
    public boolean draw(Canvas canvas, MapView mapView, boolean shadow,
            long when) {
        super.draw(canvas, mapView, shadow);
        // ---translate the GeoPoint to screen pixels---
        Point screenPts = new Point();
        mapView.getProjection().toPixels(p, screenPts);

        // ---add the marker---
        Bitmap bmp = BitmapFactory.decodeResource(getResources(),
                R.drawable.marker);
        canvas.drawBitmap(bmp, screenPts.x, screenPts.y - 48, null);

        return true;
    }

    @Override
    public boolean onTouchEvent(MotionEvent event, MapView mapView) {
        // ---when user lifts his finger---
        if (event.getAction() == 1) {
            GeoPoint p = mapView.getProjection().fromPixels(
                    (int) event.getX(), (int) event.getY());

            Toast.makeText(
                    getBaseContext(),
                    p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6()
                            / 1E6, Toast.LENGTH_SHORT).show();

        }
        return false;
    }
}
</code></pre>

<p>}</p>
