照着联机帮助文档里的示例代码写的,配置的,运行后代码不报错,界面一片漆黑。
//打开工作空间
Workspace workspace = new Workspace();
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo();
info.setServer("/sdcard/SampleData/GeometryInfo/World.smwu");
info.setType(WorkspaceType.SMWU);
workspace.open(info);
//将地图显示控件和工作空间关联
MapView mapView = findViewById(R.id.mapview);
MapControl mapcontrol = mapView.getMapControl();
mapcontrol.getMap().setWorkspace(workspace);
//打开工作空间中的第1幅地图
String mapName = workspace.getMaps().get(1);
mapcontrol.getMap().open(mapName);
mapcontrol.getMap().refresh();