Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>create your own itemized overlay, and override the onTap method, and in your main class, make an instance of the itemized overlay, and call overlay.onTap(point)</p> <p>Sample code:</p> <pre><code>public class MyItemizedOverlay&lt;Item&gt; extends ItemizedOverlay&lt;OverlayItem&gt; { private ArrayList&lt;OverlayItem&gt; m_overlays; private MapView mapView; final MapController mc; public MyItemizedOverlay(Drawable defaultMarker, MapView mapView) { super(boundCenterBottom(defaultMarker), mapView); m_overlays = new ArrayList&lt;OverlayItem&gt;(); mc = mapView.getController(); populate(); } public void addOverlay(OverlayItem overlay) { m_overlays.add(overlay); setLastFocusedIndex(-1); populate(); } public ArrayList&lt;OverlayItem&gt; getOverlays() { return m_overlays; } public final boolean onTap(int index) { GeoPoint point; point = createItem(index).getPoint(); mc.animateTo(point); return true; } ... } </code></pre> <p>In the main class</p> <pre><code>public class Main extends MapActivity { private MapView mapView; private List&lt;Overlay&gt; mapOverlays; private MyItemizedOverlay overlay; private Drawable pin; public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.main); doAction(); } private void doAction() { mapView = (MapView)findViewById(R.id.map_view); pin = res.getDrawable(R.drawable.pin); overlay = new MyItemizedOverlay(pin, mapView); GeoPoint point = new GeoPoint((int)(7*1E6),(int)(42*1E6)); overlayItem = new OverlayItem(point, "title", "text"); overlay.addOverlay(overlayItem); mapOverlays = mapView.getOverlays(); mapOverlays.add(overlay); //we tap the point here overlay.onTap(0); } } </code></pre>
    singulars
    1. This table or related slice is empty.
    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.
    3. VO
      singulars
      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