what is the better way for zoom the map to show all the route after getting it?
I tried to do it with my Origin and Destination, but not working well if the route go over or down those.
what is the better way for zoom the map to show all the route after getting it?
I tried to do it with my Origin and Destination, but not working well if the route go over or down those.
You will need to create a bounding box for your camera to animate to.
LatLngBounds latLngBounds = new LatLngBounds.Builder()
.include((new LatLng(origin.latitude() , origin.longitude())))
.include((new LatLng(dest.latitude(), dest.longitude())))
.build();
map.animateCamera(CameraUpdateFactory.newLatLngBounds(latLngBounds, 250));