Reverse Geocode Android

1032
1
07-10-2013 11:29 AM
JackyNguyen
New Contributor
I am new to ArcGIS and I am working on Geocode and reverse geocode.
I use the sample project Place Search and i want to add reverse geocode function that after we provide the address, we put a graphic on the layer showing where we are at. When a user tap on the graphic, i want to show the street name of that location by using Toast.makeText, but i am unable to.
Here is my code:

private void identityLocation(float x, float y)
 {
  searchFeature(x, y);
  
  if(identifyGraphic !=null)
  {
   
   Point mapPoint = mMapView.toMapPoint(x,y);
   Point currentPoint = (Point) GeometryEngine.project(mapPoint, SpatialReference.create(4326), mMapView.getSpatialReference());
   try {
    locRev = locator.reverseGeocode(currentPoint, 2000.0);
    s = locRev.getAddressFields().get("StreetName");    
   } catch (Exception e) {
    e.printStackTrace();
   }  
   Toast.makeText(getApplicationContext(), s, Toast.LENGTH_LONG).show();   
  }

Can someone please help. Thank you
0 Kudos
1 Reply
DanO_Neill
Occasional Contributor III
Answer provide in cross-post here.
0 Kudos