Slideshow

Monday, April 9, 2012

Get geo cordinates on Android MapView click

Add the method below to your class extending Overlay

 @Override
        public boolean onTap(GeoPoint point, MapView mapView)
        {
          Context contexto = mapView.getContext();
          String msg = "Lat: " + point.getLatitudeE6()/1E6 + " - " +
                       "Lon: " + point.getLongitudeE6()/1E6;

          Toast toast = Toast.makeText(contexto, msg, Toast.LENGTH_SHORT);
          toast.show();

         return true;
        }

0 comments:

Post a Comment