newPosition = new CameraPosition(new LatLng(latitude, longitude), zoomLevel, tilt, currentBearing);
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(newPosition);
googleMap.animateCamera(cameraUpdate);
When I zoom in or move the camera to another point using animateCamera(), it takes a long time for it to refresh the map (it looks blurry). But if I tap the screen or slightly move the camera manually after animation ends, it immediately refreshes.
it looks like this after moving the camera
I want it to refresh and look like this after animation
I searched it in google maps documents but I didn't find a method for refreshing the map. Is there a way to refresh it programmatically?
CodePudding user response:
I fixed this by calling moveCamera() when the animation ends. I am moving the camera to the same location just to make google maps load the map immediately. Couldn't find a better way.
CameraPosition newPosition = newCameraPosition(newLatLng(latitude,longitude), zoomLevel, tilt, currentBearing);
CameraUpdate cameraUpdate = CameraUpdateFactory.newCameraPosition(newPosition);
googleMap.animateCamera(cameraUpdate, new GoogleMap.CancelableCallback() {
@Override public void onCancel() {}
@Override
public void onFinish() {
googleMap.moveCamera(cameraUpdate);
}
});