title: How can move camera in google map to marker android
body: <p>I developing application that works on maps.So now I fetch marker from database to map.
  I appear only one marker .but camera Do not go to mark shown in the map.</p>
  
  <p>In addition, every time can a new marker appears, its location is different from the previous one. depending on the data stored in the database of Latitude and Longitude.</p>
  
  <p>anyone know solution for that?</p>
  
  <pre><code>public class MainActivity extends AppCompatActivity implements OnMapReadyCallback {
      MapFragment mapFragment;
      GoogleMap gMap;
      MarkerOptions markerOptions = new MarkerOptions();
      CameraPosition cameraPosition;
      LatLng center, latLng;
      String title;
  
  
      public static final String ID = "id";
      public static final String TITLE = "nama";
      public static final String LAT = "Latitude";
      public static final String LNG = "Longitude";
  
  
  
      @Override
      protected void onCreate(Bundle savedInstanceState) {
          super.onCreate(savedInstanceState);
          setContentView(R.layout.activity_main);
  
          SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager().findFragmentById(R.id.map);
          mapFragment.getMapAsync(this);
      }
  
  
  
      @Override
      public void onMapReady(GoogleMap map) {
          gMap = map;
  
          getMarkers();
  
  
  
      }
      private void addMarker(LatLng latlng, final String title) {
          markerOptions.position(latlng);
        markerOptions.title(title);
          gMap.addMarker(markerOptions);
  
          gMap.setOnInfoWindowClickListener(new GoogleMap.OnInfoWindowClickListener() {
  
              @Override
              public void onInfoWindowClick(Marker marker) {
  
                  Toast.makeText(getApplicationContext(), marker.getTitle(), Toast.LENGTH_SHORT).show();
              }
          });
      }
  
  
      private void getMarkers() {
          StringRequest stringRequest = new StringRequest(Request.Method.POST, url, new Response.Listener&lt;String&gt;() {
  
              @Override
              public void onResponse(String response) {
                  Log.e("Response: ", response.toString());
  
                  try {
                      JSONObject jObj = new JSONObject(response);
                      String getObject = jObj.getString("map");
                      JSONArray jsonArray = new JSONArray(getObject);
  
                      for (int i = 0; i &lt; jsonArray.length(); i++) {
                          JSONObject jsonObject = jsonArray.getJSONObject(i);
                          //title = jsonObject.getString(TITLE);
                          latLng = new LatLng(Double.parseDouble(jsonObject.getString(LAT)), Double.parseDouble(jsonObject.getString(LNG)));
  
  
                          addMarker(latLng, title);
                      }
  
                  } catch (JSONException e) {
                      // JSON error
                      e.printStackTrace();
                  }
  
              }
          }, new Response.ErrorListener() {
  
              @Override
              public void onErrorResponse(VolleyError error) {
                  Log.e("Error: ", error.getMessage());
                  Toast.makeText(MainActivity.this, error.getMessage(), Toast.LENGTH_LONG).show();
              }
          });
  
  
          RequestQueue requestQueue = Volley.newRequestQueue(getApplicationContext());
          requestQueue.add(stringRequest);
  
      }
  }
  
  
  </code></pre>