JianYA JianYA - 6 months ago 29
Android Question

Android Google Maps go to current location without animation

I know this might be a little silly and I must have missed something but how do I disable that animation that zooms in all the way to my marker and load up google maps and my current location immediately?

This is my current code

@Override
public void onLocationChanged(Location location) {
currentLocation = location;
String curr_location = currentLocation.getLatitude()+ ","+currentLocation.getLongitude();
LatLng coordinates = new LatLng(currentLocation.getLatitude(),currentLocation.getLongitude());
CameraUpdate current = CameraUpdateFactory.newLatLngZoom(coordinates,15);
googleMap.animateCamera(current);
UpdateLocation(userid,email,curr_location);
}


I'd like to remove the animate camera if possible. thanks!

Answer

Replace

googleMap.animateCamera(current);

with

googleMap.moveCamera(current);

(Reference)