Google Maps not refocusing

I'm working on a very simple android project where I enter a certain latitude and longitude and then open another activity showing Google Maps centered on that location.

I can pass the location just fine, and also center the map over that location. The problem is that the map is not refocusing when I zoom in (as in, it's not showing more details).

Here's my code:

public class MapsActivity extends FragmentActivity implements OnMapReadyCallback {

private GoogleMap mMap;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_maps);
    SupportMapFragment mapFragment = (SupportMapFragment) getSupportFragmentManager()
            .findFragmentById(R.id.map);
    mapFragment.getMapAsync(this);

}

@Override
public void onMapReady(GoogleMap googleMap) {

    mMap = googleMap;

    Double Latitude = getIntent()
            .getExtras()
            .getDouble("LATITUDE");

    Double Longitude = getIntent()
            .getExtras()
            .getDouble("LONGITUDE");


    LatLng currentGeoPos = new LatLng(Latitude, Longitude);
    mMap.addMarker(new MarkerOptions()
            .position(currentGeoPos)
            .title("GeoPos Marker - Lat: "
                    + Latitude + ",Long: "
                    + Longitude));

    CameraPosition position =
            new CameraPosition.Builder()
                    .target(currentGeoPos)
                    .zoom(10)
                    .build();

    CameraUpdate update = CameraUpdateFactory.newCameraPosition(position);
    mMap.moveCamera(update);
}

}

Am I missing some crucial event handler? I'm still very new to Android (and Java). Any help will be greatly appreciated.

1 answer

  • answered 2017-06-17 19:42 user8175879

    All you have to do is increase the zoom level. Try 18.