Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You need to extend this <a href="http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/ItemizedOverlay.html" rel="nofollow">http://code.google.com/android/add-ons/google-apis/reference/com/google/android/maps/ItemizedOverlay.html</a>.</p> <pre><code>public class CustomOverlay extends ItemizedOverlay&lt;OverlayItem&gt; { private Context context; private ArrayList&lt;OverlayItem&gt; mOverlays = new ArrayList&lt;OverlayItem&gt;(); public CustomOverlay(Drawable defaultMarker, Context context) { super(boundCenterBottom(defaultMarker)); this.context = context; //after adding things to the overlay, call these: setLastFocusedIndex(-1); populate(); } @Override protected boolean onTap(int index) { //called when an item is tapped return true; } @Override public boolean onTap (final GeoPoint p, final MapView mapV) { boolean tapped = super.onTap(p, mapV); if(!tapped){ //you can use this to check for other taps on the custom elements you are drawing } return true; } @Override public void draw(Canvas canvas, MapView mapV, boolean shadow){ if(!shadow) // if you have a custom image you may not want the shadow to be drawn super.draw(canvas,mapV,shadow); if(selected != null) { // selected just means that something was clicked // it isn't defined in this example Projection projection = mapV.getProjection(); Point drawPoint = projection.toPixels(selected.getPoint(), null); //get coordinates so you can do your drawing code afterward } } @Override protected OverlayItem createItem(int i) { return mOverlays.get(i); } @Override public int size() { return mOverlays.size(); } } </code></pre> <p>This is a very rough sketch of what you need to do. Hope this helps.</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. 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