0

I have a position, which I need to display. The format is like:

lat: 59.915494, lng: 30.409456

Also I need to display current position of the user. The following code:

    MyLocationOverlay myLocationOverlay = new MyLocationOverlay(this, mapView);
    mapView.getOverlays().add(myLocationOverlay); 
    myLocationOverlay.enableMyLocation(); 

doesn't center map on the current position.

LA_
  • 19,823
  • 58
  • 172
  • 308

1 Answers1

2

In order to adjust where the map is centered on or zoomed into you need to get the MapController.

MapController controller = mMapView.getController();
controller.animateTo(geoPoint);
// Or if you just want it to snap there
controller.setCenter(geoPoint);

controller.setZoom(5); 

That point that you want to show you're going to need to add an Overlay. Here is the documentation for that and a nice tutorial on how to do it.

CaseyB
  • 24,780
  • 14
  • 77
  • 112