Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Android - Get Click Event of Map Overlay Item

Tags:

java

android

I have a MapView with Overlays like this:

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.getOverlays().add(itemizedOverlay);
}
}

public class MapItemizedOverlay extends ItemizedOverlay<OverlayItem>
{

  //some code

@Override
protected boolean onTap(int index)
{
//Here I know what marker been clicked...
}
}

I know i get what marker has been clicked in the MapItemizedOverlay class. But how do i use this in my MapView? What i want i show a balloon tip when an OverlayItem is clicked like here Show popup above map marker in MapView.

Please guide me, I dont know what to do at all...

Thanks a lot.

like image 421
GuyFawkes Avatar asked May 05 '11 11:05

GuyFawkes


1 Answers

Got it. Used this excellent project. works like a charm:

https://github.com/jgilfelt/android-mapviewballoons

Just Check out both the Project and the example.

like image 134
GuyFawkes Avatar answered Oct 16 '22 23:10

GuyFawkes