我将经纬度坐标存储在 sqlite 数据库中。我正在尝试通过光标检索这些并将它们全部放在地图上。我正在尽我所能,但我是新手,需要一点帮助。这是我到目前为止所拥有的:
public class allmapactivity extends MapActivity {
MapController mControl;
GeoPoint GeoP;
MapView mapV;
private SQLiteAdapter mySQLiteAdapter;
Cursor cursor;
@Override
protected void onCreate(Bundle savedInstanceState) {
// TODO Auto-generated method stub
super.onCreate(savedInstanceState);
setContentView(R.layout.map);
setRequestedOrientation(ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
mapV = (MapView) findViewById(R.id.mapview);
mapV.displayZoomControls(true);
mapV.setBuiltInZoomControls(true);
mapV.setSatellite(false);
List<Overlay> mapOverlays = mapV.getOverlays();
Drawable drawable = this.getResources().getDrawable(R.drawable.pin);
HelloItemizedOverlay itemizedoverlay = new HelloItemizedOverlay(drawable, this);
cursor = mySQLiteAdapter.queueAll5();
GeoPoint point = new GeoPoint((int) (Double.valueOf(SQLiteAdapter.KEY_CONTENT11) *1E6),(int) (Double.valueOf(SQLiteAdapter.KEY_CONTENT12) *1E6));
OverlayItem overlayitem = new OverlayItem(point, "Test", "Test");
itemizedoverlay.addOverlay(overlayitem);
mapOverlays.add(itemizedoverlay);
}
@Override
protected boolean isRouteDisplayed() {
// TODO Auto-generated method stub
return false;
}
}
当我为我的地理点输入静态数字时,所有这些代码都有效,除非我尝试从光标添加数据时,它会强制关闭。任何帮助都会很棒!