Alex Rivera | Logout

How to get the Latitude and Longitude on Map in Android?

Asked 2010-12-15T04:53:17.507
14

How can I get the Latitude and Longitude values of a particular location that I have long clicked on the map in Android?

Edit
Report

1 Answer

4

You'll have to manage the LongClick event, and then use the code to find out longitude and latitude with the following code:

GeoPoint geoPoint=mapView.getProjection().fromPixels((int)event.getX(),(int)event.getY());
int latitude = geoPoint.getLatitudeE6();
int longitude = geoPoint.getLongitudeE6();

where 'event' is the object of 'MotionEvent'.

Use any other event according to your case.

answered 2010-12-15T05:10:31.123

Your Answer