android imobile10报错

0 投票
protected void openMap2() {

    m_workspace = new Workspace();
    m_mapView = findViewById(R.id.map_view);
    m_mapControl = m_mapView.getMapControl();
    WorkspaceConnectionInfo info = new WorkspaceConnectionInfo();
    info.setType(WorkspaceType.SMWU);
    info.setServer(rootPath + "/SampleData/GeometryInfo/test.smwu");
    m_workspace = new Workspace();
    m_workspace.open(info);
    m_mapControl.getMap().setWorkspace(m_workspace);
    String mapname = m_workspace.getMaps().get(0);//这一行报错
    m_mapControl.getMap().open(mapname);

}

报错内容:

   Caused by: java.lang.IndexOutOfBoundsException: index
    索引越界
        at com.supermap.data.Maps.get(Maps.java:81)
        at com.luyang.lightsystem.gis.GISMapActivity.openMap2(GISMapActivity.java:110)
        at com.luyang.lightsystem.gis.GISMapActivity.onCreate(GISMapActivity.java:38)
        at android.app.Activity.performCreate(Activity.java:7893)
        at android.app.Activity.performCreate(Activity.java:7880)
        at android.app.Instrumentation.callActivityOnCreate(Instrumentation.java:1307)

3月 2 分类:  74次浏览 | 用户: lvjian123 (3 分)

1个回答

0 投票
您好,报错索引越界您可以检查以下几点:
1.调试代码。看工作空间是否打开成功,可以通过workspace.open()方法返回的Boolean变量判断
2.如果工作空间打开成功,可以在iDesktop桌面软件中查看该工作空间中是否有地图存在
3月 2 用户: 董懿鑫 登峰造极 (8,230 分)
...