Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>There are two ways you can achieve what you are looking for and below is the code:</p> <pre><code>@Override public boolean onTap(GeoPoint p, MapView mapView) { Log.d("tap event ", "tap called"); mapOverlays = mapView.getOverlays(); drawable =getResources().getDrawable(R.drawable.marker); itemizedOverlay = new SitesOverlay(drawable); int lat=(int)p.getLatitudeE6(); int lng=(int)p.getLongitudeE6(); GeoPoint point = new GeoPoint(lat,lng); Log.d("tap event ", "tapcalled"+lat+""+lng); OverlayItem overlayitem = new OverlayItem(point, "", ""); items.add(overlayitem); populate(); Log.d("tap event ", "populated"); // mapOverlays.add(itemizedOverlay); return true; } </code></pre> <p>and you can do this in this way but this doesn't add any overlay item/pin/marker on the map.</p> <pre><code>@Override public boolean onTouchEvent(MotionEvent event, MapView mapView) { //---when user lifts his finger--- if (event.getAction() == 1) { p = mapView.getProjection().fromPixels( (int) event.getX(), (int) event.getY()); Toast.makeText(getBaseContext(), p.getLatitudeE6() / 1E6 + "," + p.getLongitudeE6() /1E6 , Toast.LENGTH_SHORT).show(); } return false; } </code></pre> <p>Here is the link to the tutorial to detect touch any where on the Map </p> <p><a href="http://android-coding.blogspot.com/2011/08/detect-touch-on-mapview-ontapgeopoint-p.html" rel="nofollow">Detect touch on MapView</a></p> <p>To make marker/pin/item overlay over the map and detect on click of each pin/marker</p> <p><a href="http://android-coding.blogspot.com/2011/08/detect-touch-on-marker-in-mapview.html" rel="nofollow">Detect touch on marker in MapView</a></p> <p>I hope this will help you :)</p> <p>Thanks.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload