private void initMap(){ String sdcard = android.os.Environment.getExternalStorageDirectory().getAbsolutePath().toString(); setContentView(R.layout.activity_main); Button btnOpen = (Button) findViewById(R.id.btn_open); btnOpen.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { //打开工作空间 Workspace workspace = new Workspace(); WorkspaceConnectionInfo info = new WorkspaceConnectionInfo(); info.setServer(sdcard + "/SampleData/CBD_android/CBD_android.sxwu"); info.setType(WorkspaceType.SXWU); workspace.open(info); //场景显示控件与工作空间相关联 SceneControl sceneControl = (SceneControl) findViewById(R.id.SceneControl); Scene scene = sceneControl.getScene(); scene.setWorkspace(workspace); //打开场景 String sceneName = workspace.getScenes().get(0); scene.open(sceneName); } }); } public void finish() { moveTaskToBack(true); } }