Code example for Marker

Methods: remove, setPosition

0
        setProgressBarIndeterminateVisibility(true); 
    } 
 
    private void moveMarkerTo(LatLng position) {
        if (mMarker != null) {
            mMarker.remove();
        } 
        mMarker = mMap.addMarker(new MarkerOptions().position(position));
        mMarker.setPosition(position);
    } 
 
    @Override 
    public void onReverseGeocodingResultReady(Object sender, Address result) {
        if (result != null) {
            mMarker.setTitle(DefaultAddressFormatter.format(result, ", "));
            String fmt = "Lat: %s, lon: %s";
            String snippet = String.format(fmt, result.getLatitude(), result.getLongitude());
            mMarker.setSnippet(snippet);
            mMarker.showInfoWindow();
        } else { 
            Toast.makeText(this, R.string.geocoding_error_toast, Toast.LENGTH_LONG).show();