这是我的覆盖类
public class Overlay extends ItemizedOverlay<OverlayItem> {
public Overlay(Drawable defaultMarker) {
super(boundCenter(defaultMarker));
}
private ArrayList<OverlayItem>mOverlays= new ArrayList<OverlayItem>();
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
@Override
protected OverlayItem createItem(int i) {
return mOverlays.get(i); }
@Override
public int size() {
return mOverlays.size();
}
@Override
protected boolean onTap(int index) {
return true;
}
}
当我将此叠加层添加为:
在 OnCreate-->
Overlay overlay=new Overlay (drawable);
List<Overlay> mapOverlays = mapView.getOverlays();
GeoPoint myGeoPoint = new GeoPoint((mGeoPoint.getLatitudeE6()),
(mGeoPoint.getLongitudeE6()));
OverlayItem mOverlayItem = new OverlayItem(myGeoPoint, "", "");
overlay.addOverlay(mOverlayItem );
mapOverlays.add(overlay);
并得到 NullPointeException 为什么?请给我解决方案。
谢谢。