0

I have a mapview where I add pins.

Here is the CustomPinPoint class:

   public class CustomPinpoint extends ItemizedOverlay<OverlayItem>{


private ArrayList<OverlayItem> pinpoints = new ArrayList<OverlayItem>();
private Context c;


public CustomPinpoint(Drawable defaultMarker) {
    super(boundCenter(defaultMarker));
    // TODO Auto-generated constructor stub
}
public CustomPinpoint(Drawable m, Context context) {
    // TODO Auto-generated constructor stub
    this(m);
    c = context;
}

@Override
protected OverlayItem createItem(int i) {
    // TODO Auto-generated method stub
    return pinpoints.get(i);
}

@Override
public int size() {
    // TODO Auto-generated method stub
    return pinpoints.size();
}

public void insertPinpoint(OverlayItem item){
    pinpoints.add(item);
    this.populate();
}
  }

and this is the way I add pins :

   Touchy t = new Touchy();
   overlayList = map.getOverlays();
   overlayList.add(t);
   compass = new MyLocationOverlay(Map.this, map);
   overlayList.add(compass);
   controller = map.getController();
   OverlayItem overlayItem = new OverlayItem(ourLocation, "What's up", "2nd String");
   CustomPinpoint custom = new CustomPinpoint(d, Map.this);
   custom.insertPinpoint(overlayItem);
   overlayList.add(custom); 

Everything is ok but I do not know how I could make a balloon (or another class) appear when I tap the pin. I have a database with description for every pin so I would need to appear the description for every click on a pin.

JJJ
  • 32,902
  • 20
  • 89
  • 102
stanga bogdan
  • 724
  • 2
  • 8
  • 26
  • Did you try searching before posting? There are tonnes of resources on this. A few I found: http://stackoverflow.com/questions/3880623/how-to-show-a-balloon-above-a-marker-in-a-mapactivity-isnt-there-a-widget and http://stackoverflow.com/questions/3707923/show-popup-above-map-marker-in-mapview – Urban May 17 '12 at 18:10
  • I saw those and all of them advice the person who asks to look on the github and I didn't succed to make it works. I couldn't implement it. – stanga bogdan May 17 '12 at 18:13
  • So the problem you have is with the implementation of one of these libraries (I use BaloonItempizedOverlay https://github.com/jgilfelt/android-mapviewballoons and it works like a charm). Try to implement it and when you encounter a problem, write another question on SO. There is no native support for balloons in android sdk, so you have to use one of such libraries (or write one yourself) – Michał Klimczak May 20 '12 at 12:03

0 Answers0