Find distance between two points on map using Google Map API V2

In Google Map API V2 You have LatLng objects so you can’t use distanceTo (yet). You can then use the following code considering oldPosition and newPosition are LatLng objects : // The computed distance is stored in results[0]. //If results has length 2 or greater, the initial bearing is stored in results[1]. //If results has … Read more

How to get center of map for v2 android maps?

I had the same problem. It seems you can get the center this way: mMap.getCameraPosition().target where mMap is the GoogleMap instance from your activity. This will return a LatLng object which basically represents the center of the map. Note that the GeoPoint class is not available anymore. According to http://developer.android.com/reference/com/google/android/gms/maps/model/CameraPosition.html target is “The location that … Read more

Google Maps v2 – set both my location and zoom in

You cannot animate two things (like zoom in and go to my location) in one google map? From a coding standpoint, you would do them sequentially: CameraUpdate center= CameraUpdateFactory.newLatLng(new LatLng(40.76793169992044, -73.98180484771729)); CameraUpdate zoom=CameraUpdateFactory.zoomTo(15); map.moveCamera(center); map.animateCamera(zoom); Here, I move the camera first, then animate the camera, though both could be animateCamera() calls. Whether GoogleMap consolidates these … Read more