Adi Khan
Adi Khan

Reputation: 157

Get longitude and latitude by touch event

How can i get the longitude and latitude of a place by touch event on marker. I want when user click on map somewhere it will get its latitude and longitude. Please help me out. Thanks

Upvotes: 0

Views: 1449

Answers (1)

S.Thiongane
S.Thiongane

Reputation: 6915

Just override the onMapClick method of GoogleMap.OnMapClickListener class. You will get the LatLng point of the clicked area, then :

map.setOnMapClickListener(new OnMapClickListener() {

    @Override
    public void onMapClick(LatLng point) {
        // TODO Auto-generated method stub
        double lat = point.latitude;
        double lng = point.longitude;    
    }
});

Upvotes: 4

Related Questions