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().
This is how it should be done:
Reference: moveCamera with CameraUpdateFactory.newLatLngBounds crashes
There is another easy way, you can use this project to accomplish all map related activities:
https://github.com/girishnair12345/Google-Maps-V2-library