I’ve got 2 GeoPoints given to show them on the map with markers.
How can I get the optimum zoom level for the MapController in order to focus the middle of both points, but also have them on the map.
The whole thing should work at different screen resolutions.
You can do this using the MapView’s MapController. You get the MapController using MapView.getController(), then you can attempt to set the correct zoom using MapController.zoomToSpan(). I also tend to use ItemizedOverlay’s getLatSpanE6() and getLonSpanE6() to make this simpler. An example:
It is important to note their caveat:
Edit: In order to also get the map to zoom on the correct place, you have to use MapController.setCenter().