title: Adding New Marker onLongMapClick Using Android Studio and Google Maps API
body: <p>I have been trying for hours to add a new marker onLongMapClick in the code below. I've searched a lot but nothing seems to be working. I'm using Android Studio 1.5.1 and Google Maps API. I'm testing my app on a Nexus 6P emulator. API 23. I left it blank between the brackets at the bottom where I think the code is supposed to go. The code below is in public class BasicMapDemoActivity extends AppCompatActivity implements OnMapReadyCallback { and I can't seem to figure out how to do it. Can anyone please help me make this happen? I can provide what ever other information might be useful. Thank you!</p>
  
  <pre><code>GoogleMap mMap;
  private UiSettings mUiSettings;
  
  @Override
  protected void onCreate(Bundle savedInstanceState) {
      super.onCreate(savedInstanceState);
      setContentView(R.layout.basic_demo);
      SupportMapFragment mapFragment =
              (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
      mapFragment.getMapAsync(this);
  }
  
  @Override
  public boolean onCreateOptionsMenu(Menu menu) {
      // Inflate the menu; this adds items to the action bar if it is present.
      getMenuInflater().inflate(R.menu.activity_main, menu);
      return true;
  }
  
  @Override
  public boolean onOptionsItemSelected(MenuItem item) {
      // Handle item selection
      if (item.getItemId() == R.id.menu_legal) {
          startActivity(new Intent(this, LegalInfoActivity.class));
          return true;
      }
      return super.onOptionsItemSelected(item);
  }
  
  @Override
  public void onMapReady(GoogleMap map) {
  
      mMap = map;
      mUiSettings = mMap.getUiSettings();
      mUiSettings.setZoomControlsEnabled(true);
      mUiSettings.setScrollGesturesEnabled(true);
      mUiSettings.setZoomGesturesEnabled(true);
  
  
  mMap.setOnMapClickListener(new GoogleMap.OnMapClickListener() {
      @Override
      public void onMapClick(LatLng point) {
      }
  });
  
  
  mMap.setOnMapLongClickListener(new GoogleMap.OnMapLongClickListener() {
      @Override
      public void onMapLongClick(LatLng point) {
      }
  });
  
  mMap.setOnCameraChangeListener(new GoogleMap.OnCameraChangeListener() {
      @Override
      public void onCameraChange(CameraPosition position) {
          float maxZoom = 7.0f;
          if (position.zoom &gt; maxZoom) {
              mMap.animateCamera(CameraUpdateFactory.zoomTo(maxZoom));
          }
      }
  });
  }
  </code></pre>
  
  <p>}</p>