Joe Joe - 4 months ago 39
Android Question

How to show both markers on Google Maps?

I have a maps activity that displays an origin and a destination location (Point A and Point B). However, when the origin and destination locations are inputted. Only the Origin is displayed initially. You would have to zoom out to see the destination on the map. How can I show both markers at the same time?

I would like it to fill the entire fragment


You need to set up a LatLng bounds to fit all of your points (in this case, just two) within the Map's camera. Take this code for example:

final LatLngBounds.Builder builder = new LatLngBounds.Builder();
builder.include(markerA.getPosition()); // this is a LatLng value
mMap.moveCamera(CameraUpdateFactory.newLatLngBounds(, 100));