好的,目前我在添加到覆盖列表时遇到空指针异常。我在地图活动类的顶部声明了这一点:
private static List<Overlay> mOverlays;
然后再往下,我已经为我的来源/从点得到了这个:
Drawable fromDrawable = getResources().getDrawable(R.drawable.pin_blue);
OverlayItem fromOverlayItem = new OverlayItem(fromGeoPoint, "Hello!", "This is your current Location.");
MapWhatsNearOverlay fromItemizedOverlay = new MapWhatsNearOverlay(fromDrawable);
mOverlays.add(fromItemizedOverlay);
connectAsyncTask _connectAsyncTask = new connectAsyncTask();
_connectAsyncTask.execute();
mMapView.getOverlays().add((Overlay) mOverlays);
目的地也是一样,但是在处理最后一行代码时会弹出空指针异常。