title: How to set marker on center of the map?
body: <p>I want to use a map view in my app which will show the markers position when we drag the map. For that I have got that it can be done by setting the marker at the center of the map so when we drag the map we can get the address of the current position. Like this : <a href="https://i.stack.imgur.com/PBVrw.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/PBVrw.png" alt="enter image description here"></a> </p>
  
  <p>But I don't know how to achieve this. Hope I will get help from here.</p>
  
  <p>ChooseFromMapActivity</p>
  
  <pre><code>public class ChooseFromMapActivity extends AppCompatActivity implements GoogleMap.OnCameraChangeListener {
  
      TextView textShowAddress;
      private GoogleMap mMap;
      LatLng latLng;
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_choose_from_map);
          Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
          setSupportActionBar(toolbar);
  
          SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
                  .findFragmentById(R.id.map);
          mMap = mapFragment.getMap();
  
          mMap.getUiSettings().setZoomControlsEnabled(true);
          mMap.getUiSettings().setRotateGesturesEnabled(true);
          mMap.getUiSettings().setScrollGesturesEnabled(true);
  
          latLng = new LatLng(-34, 151);
          mMap.addMarker(new MarkerOptions().position(latLng).title("Marker in Sydney"));
          mMap.moveCamera(CameraUpdateFactory.newLatLng(latLng));
  
          textShowAddress = (TextView) findViewById(R.id.textShowAddress);
  
          if (Build.VERSION.SDK_INT &gt;= 21) {
              getWindow().clearFlags(WindowManager.LayoutParams.FLAG_TRANSLUCENT_STATUS);
              getWindow().setStatusBarColor(getResources().getColor(R.color.colorPrimaryDark));
          }
    }
      @Override
      public void onCameraChange(CameraPosition position) {
          mMap.clear();
          mMap.addMarker( new MarkerOptions()
                          .position( position.target )
                          .title( position.toString() )
          );
      }
  }
  </code></pre>