dong221 dong221 - 1 year ago 136
Android Question

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

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.


Answer Source

you can use this to zoom directly without the animation :

map.moveCamera( CameraUpdateFactory.newLatLngZoom(new LatLng(xxxx,xxxx) , 14.0f) );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download