我正在使用 Google Maps for Android 做一个项目。我创建了一个 MapActivity 来加载我保存在服务器上的一些地方。所以我有这门课
public class PlaceItemizedOverlay extends ItemizedOverlay<OverlayItem> {
private ArrayList<OverlayItem> mOverlays = new ArrayList<OverlayItem>();
Context mContext = null;
MapActivity mapAct = null;
public PlaceItemizedOverlay(Drawable defaultMarker, MapActivity map) {
super(boundCenterBottom(defaultMarker));
this.macAct = map;
}
public PlaceItemizedOverlay(Drawable defaultMarker, Context context) {
super(boundCenterBottom(defaultMarker));
mContext = context;
}
@Override
protected OverlayItem createItem(int i) {
return mOverlays.get(i);
}
public void addOverlay(OverlayItem overlay) {
mOverlays.add(overlay);
populate();
}
@Override
public int size() {
return mOverlays.size();
}
@Override
protected boolean onTap(int index) {
OverlayItem item = mOverlays.get(index);
AlertDialog.Builder dialog = new AlertDialog.Builder(mContext);
dialog.setTitle(item.getTitle());
dialog.setMessage(item.getSnippet());
dialog.show();
this.mapAct.finish();
return true;
}
好吧,当我单击保存的位置时,程序会中断。
我在 mapActivity 上创建对象:
PlaceItemzedOverlay itemizedoverlay = new PlaceItemizedOverlay(drawable, this);
你能帮我吗?
非常感谢!