Using the MapView in android, how can I set a default location, so that everytime I load up this application, it automatically centers/zooms location in on London?
Asked
Active
Viewed 1.5k times
2 Answers
40
Firstly, get the controller for the given map:
MapController myMapController = myMapView.getController();
and then call:
myMapController.setCenter(new GeoPoint())
This will set the center of the map on the given GeoPoint.
See docs for MapView and MapController for more info

Matt Lyons-Wood
- 931
- 11
- 17

matekm
- 5,990
- 3
- 26
- 31
1
For new Google Maps API you need to do this:
mapFragment.getMapAsync(this::setUpMaps);
And inside setUpMaps(GoogleMap googleMap)
you should move camera to your default location:
googleMap.moveCamera(CameraUpdateFactory.newLatLngZoom(location, zoom));

soshial
- 5,906
- 6
- 32
- 40