adding fields to OverlayItem

196 views Asked by At

A simple questions about OverlayItem. I my map android application, tapping on a location, I would show some info like: name, infoq, info2, info3. So I extend the OverlayItems:

public class NewOverlayItem extends OverlayItem {

    public NewOverlayItem(GeoPoint point, String title, String snippet1, String snippet2, String snippet3) {
        super(point, title, snippet1);

    }

}

and I use it :

NewOverlayItem overlayitem = new NewOverlayItem(geo, name, oferta, horario, info);

Now I don't know how use the itemizedOverlay.addOverlay(overlayitem); in order to show the news snippet.

I have change the definition class:

    public class MyOverlay extends ItemizedOverlay<MyOverlayItem> { 

...}

but the map still show only the first one snipped.

Tx in advance.

1

There are 1 answers

4
CommonsWare On

Well, you can extend it to store info2 and info3. You will have to arrange to display the data.

Just make sure your ItemizedOverlay uses the same type. So, if you extend OverlayItem to create DoxsiOverlayItem, your ItemizedOverlay declaration would use ItemizedOverlay<DoxsiOverlayItem> instead of ItemizedOverlay<OverlayItem>.