开发者

Android map overlay, fire onTap event by code

I have my own class to put marker over mapview like following...

public class MyMapActivity extends MapActivity
{
  private MapItemizedOverlay itemizedOverlay;

  @Override
  public void onCreate(Bundle savedInstanceState)
  {
    for(a loop to put all 10 datas into overlay)
    {
      OverlayItem overlayitem=new OverlayItem(some params);
      overlayitem.setMarker(some bitmap);
      itemizedOverlay.addOverlay(overlayitem);
    }
    mapView.getOverlay开发者_开发百科s().add(itemizedOverlay);
  }
}

public class MapItemizedOverlay extends ItemizedOverlay<OverlayItem>
{

  //some code

  @Override
  protected boolean onTap(int index)
  {
    //Here I know what marker been clicked...
    //and I already did when marker been clicked, an info window
    //can be shows up.
  }
}

For example, I have 10 data set, shows as 10 markers on map, and on a ListView. What I would like to do is when I click 3rd row of ListView, the 3rd marker will pop-up an info window, just like I'm clicked on it...

How can I do this ?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜