这是我的叠加层
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中 - &gt;
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为什么? 请给我解决方案。
感谢。