Issue
I'm trying to animate to a zoom and a location at once, but it seems that is not possible.
If i do this, it only animates to the location:
mMap.animateCamera(CameraUpdateFactory.zoomTo(16f));
mMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())));
If i do this, it only animates to the zoom:
mMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())));
mMap.animateCamera(CameraUpdateFactory.zoomTo(16f));
If I combine a moveCamera
with a animateCamera
for one of each, it works, but obviously only one has animation and the other not.
How can I animate both things, the zoom and the location?
Solution
Well, I finally do it in two steps using a callback, if you find a better way please post it:
mMap.animateCamera(CameraUpdateFactory.newLatLng(new LatLng(location.getLatitude(), location.getLongitude())), new GoogleMap.CancelableCallback() {
@Override
public void onCancel() {}
@Override
public void onFinish() {
mMap.animateCamera(CameraUpdateFactory.zoomTo(16f));
}
});
UPDATE: thanks to @B__ for his better solution: newLatLngZoom
function
Answered By - NullPointerException
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.