How do I make the marker appear in the center of the original google map window?

I am using Google Maps V2 Android in my application.

I place a marker at Singapore.

But I notice that every time my application starts, the initial window is somewhat in South America.

How can I make the map automatically scale in the Singapore area with a marker in the center?

I put the marker as follows:

googleMapLocation = new LatLng(latitude, longitude); map = ((MapFragment) getFragmentManager().findFragmentById(R.id.map)).getMap(); map.addMarker(new MarkerOptions().position(googleMapLocation).title("I am here!")); 
+4
source share
1 answer

You can use:

 map.moveCamera(CameraUpdateFactory.newLatLngZoom(googleMapLocation, zoom)); 
+6
source

Source: https://habr.com/ru/post/1491673/


All Articles