title: Allow only a certain number of markers in google maps
body: <p>I am playing with google maps (android studio), and trying to limit the number of markers a single user can pin. I couldn't find any examples online, only thing I could find is removing the current marker (code below). </p>
  
  <p>My goal is to allow the user to pin only 3 markers.</p>
  
  <pre><code>     mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
  
          @Override
          public void onMapLongClick(LatLng arg0) {
              //if there is a marker already this if condition removes it
              if (marker != null) {
                  marker.remove();
              }
              marker = mMap.addMarker(new MarkerOptions()
                      .icon(BitmapDescriptorFactory.fromResource(R.drawable.marker_02))
                      .position(
                              new LatLng(arg0.latitude,
                                      arg0.longitude))
                      .draggable(true).visible(true));
          }
      });
  </code></pre>