How do I set default location and Zoom level for google map api v2?

dong221 picture dong221 · Jan 4, 2013 · Viewed 97.7k times · Source

When my map shows, it always start at a fixed location (near Africa).

Then, I use the following code to center the map to the location I want.

mMap.animateCamera(CameraUpdateFactory.newLatLngZoom(new LatLng(loc.getLatitude(), loc.getLongitude()), 14.0f));

My question is that could I set a default location and zoom level before the map shows?

Because I don't want my users to see the animation at the beginning.

Thanks.

Answer

Moh Sakkijha picture Moh Sakkijha · Jan 4, 2013

you can use this to zoom directly without the animation :

map.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(xxxx,xxxx) , 14.0f) );