Use GeometryEngine to project mapPoint from map coordinates to geographic coordinates (i.e. longitude and latitude):
Point wgs84Point = (Point) GeometryEngine.project(
mapPoint,
mMapView.getSpatialReference(),
SpatialReference.create(SpatialReference.WKID_WGS84));
longitude = wgs84Point.getX();
latitude = wgs84Point.getY();
If you keep your Toast, you'll want to use longitude and latitude instead of x and y in the Toast string.
UPDATE
If you have x
, y
, and wkid
instead of an ArcGIS Point
object, it's easy to create a Point
yourself:
Point myPoint = new Point(x, y);
Point wgs84Point = (Point) GeometryEngine.project(
myPoint,
SpatialReference.create(wkid),
SpatialReference.create(SpatialReference.WKID_WGS84));
longitude = wgs84Point.getX();
latitude = wgs84Point.getY();