Is it possible to get latitude and longitude from Google map on touch event?
For example: if i touch the New York on map, it should give me the latitude and longitude of New York.
Instead of intercepting the TouchEvent with an overlay you can set an OnMapClickListener
directly on the GoogleMap object.
googleMap.setOnMapClickListener(new OnMapClickListener(){
void onMapClick(LatLng point){
Toast.makeText(getContext(),
point.latitude + ", " + point.longitude,
Toast.LENGTH_SHORT).show();
}
});
How to get the GoogleMap Object from a MapFragment
or a MapView
see
https://developers.google.com/maps/documentation/android/map#add_map_code
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