Hello, I have the following code and the markers are not appearing on the map at all!
private class SitesOverlay extends ItemizedOverlay<pfOverlayItem> {
private List<pfOverlayItem> items=new ArrayList<pfOverlayItem>();
//private PopupPanel panel=new PopupPanel(R.layout.popup);
public SitesOverlay() {
super(null);
items = mainOverlayArray;
populate();
}
@Override
protected pfOverlayItem createItem(int i) {
return(items.get(i));
}
@Override
public void draw(Canvas canvas, MapView mapView,
boolean shadow) {
super.draw(canvas, mapView, shadow);
}
@Override
public int size() {
return(items.size());
}
private Drawable getMarker(int resource) {
Drawable marker=getResources().getDrawable(resource);
marker.setBounds(0, 0, marker.getIntrinsicWidth(),
marker.getIntrinsicHeight());
boundCenter(marker);
return(marker);
}
}
mainOverlayArray is full of pfOverlayItem's and the code for that class is
public class pfOverlayItem extends OverlayItem {
private String coolText;
public String getcoolText() {
return coolText;
}
public void setcoolText(String coolText) {
this.coolText = coolText;
}
public pfOverlayItem(GeoPoint point, String title, String snippet) {
super(point, title, snippet);
// TODO Auto-generated constructor stub
}
}
I also set the marker outside of this after processing an XML file...
ArrayList<pfOverlayItem> overArray = myXMLHandler.getOverlayArray();
mainOverlayArray = overArray;
pfOverlayItem tempOver = null;
Drawable marker = getResources().getDrawable(R.drawable.icon);
for (int i = 0; i < mainOverlayArray.size(); i++) {
tempOver = mainOverlayArray.get(i);
tempOver.setMarker(marker);
}
sites=new SitesOverlay();
myMapView.getOverlays().add(sites);
myMapView.invalidate(); [/code]