I am using Android Google Maps Api V2 (not MapView or MapActivity) and I am having difficulty getting the coordinates for the center of the map.
I was thinking of using
@Override
public void onCameraChange(CameraPosition arg0) {
// TODO Auto-generated method stub
geoCodeCenter(/*Location object*/);
}
but I can't get the lat/long from the CameraPosition object. the camera also has more dimensions as you can look at the map at different pitches now too, so getting the center of for latitude/longitude isn't the same since the user isn't guaranteed to be looking at the map from birds eye view, unless certain gestures are disabled.
Is there a better way to do this? I don't want the user to have to long click a marker to drag it around the map, I want them to just know where the center of the map is by the user panning it around.
the map.getMyLocation()
method is for something else, like the current LocationProvider position. Also not seemingly the option, notwithstanding the fact that I am using GPS and it still returns null
but I can't get the lat/long from the CameraPosition object
The target
public data member on a CameraPosition
is a LatLng
of the map center, based upon my reading of the docs.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With