title: Why is my marker not resetting to null?
body: <p>I have a map that will only allow 1 marker at a time. But in order to stop that marker being accidentally replaced with another, it needs to be set so that the marker is cleared before another marker can be added. <br />
  I am setting the marker via onMapClick and clearing them via onMapLongClick. As it stands at the moment, the clearing and adding of markers works fine, but I cannot seem to set up the map so that you need to clear the map first. <br />
  I have tried the solution from <a href="https://stackoverflow.com/questions/22957488/check-for-existing-markers-before-adding-another">check for existing markers</a> but it hasn't worked.<br />
  Here is my code for the setup, which currently works by clearing existing marker and adding another without the need to clear the original marker first:</p>
  <pre><code>@Override
      public void onMapLongClick(LatLng position) {
          mMap.clear();
          Toast.makeText(this, &quot;Position Cleared&quot;, Toast.LENGTH_SHORT).show();
          position = null;
      }
  
      @Override
      public void onMapClick(LatLng position){
          if (position != null){
              mMap.clear();
              mMap.addMarker(new MarkerOptions()
              .position(position)
              .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher_new)));
          }
          else {
              
              mMap.addMarker(new MarkerOptions()
              .position(position)
              .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher_new)));           
          }
      }
  </code></pre>
  <p>But I thought it should be something like:</p>
  <pre><code>@Override
      public void onMapLongClick(LatLng position) {
          mMap.clear();
          Toast.makeText(this, &quot;Position Cleared&quot;, Toast.LENGTH_SHORT).show();
          position = null;
      }
  
      @Override
      public void onMapClick(LatLng position){
          if (position == null){
              //mMap.clear();
              mMap.addMarker(new MarkerOptions()
              .position(position)
              .icon(BitmapDescriptorFactory.fromResource(R.drawable.ic_launcher_new)));
          }
          else {
              Toast.makeText(this, &quot;Clear first&quot;, Toast.LENGTH_SHORT).show();
                          
          }
      }
  </code></pre>
  <p>But all that does is give me the Toast message and not be able to add a marker at all even on first load of the map.</p>
  <p>Any help would be great</p>