supermap andiord开发地图加载不出来

DKchenliyuan 2017-07-17 04:07:26
ADT Bundle开发,Genymotion 模拟器,利用SuperMap iMobile做了一个最简单的地图显示,代码如下:

activity_main中:
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="fill_parent"
android:layout_height="fill_parent"
android:id="@+id/main">
<RelativeLayout
android:gravity="left"
android:layout_width="fill_parent"
android:layout_height="fill_parent" >
<com.supermap.mapping.MapView
android:id = "@+id/Map_view"
android:layout_width="fill_parent"
android:layout_height = "fill_parent">
</com.supermap.mapping.MapView>
<ZoomControls
android:id="@+id/zoomControls"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"
android:layout_centerHorizontal="true"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>
</RelativeLayout>

MainActivity中:

package com.example.test;

import android.os.Bundle;
import android.app.Activity;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.ZoomControls;

import com.supermap.data.Environment;
import com.supermap.data.Workspace;
import com.supermap.data.WorkspaceConnectionInfo;
import com.supermap.data.WorkspaceType;
import com.supermap.mapping.MapControl;
import com.supermap.mapping.MapView;

public class MainActivity extends Activity {

private MapControl m_mapControl = null;
private Workspace m_workspace;
private MapView m_mapView;
private ZoomControls m_zoom;

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

String rootPath=android.os.Environment.getExternalStorageDirectory().getAbsolutePath();
Environment.setLicensePath(rootPath+"/SuperMap/license/");
Environment.setTemporaryPath(rootPath+"/SuperMap/temp/");
Environment.setWebCacheDirectory(rootPath+"/SuperMap/WebCache/");
Environment.initialization(this);
setContentView(R.layout.activity_main);

m_workspace=new Workspace();
WorkspaceConnectionInfo info = new WorkspaceConnectionInfo();
info.setServer(rootPath+"/SampleData/World.smwu");
info.setType(WorkspaceType.SMWU);
m_workspace.open(info);

m_mapView=(MapView)findViewById(R.id.Map_view);
m_mapControl=m_mapView.getMapControl();
m_mapControl.getMap().setWorkspace(m_workspace);

String mapName =m_workspace.getMaps().get(1);
m_mapControl.getMap().open(mapName);
m_zoom = (ZoomControls)findViewById(R.id.zoomControls);
m_mapView = (MapView)findViewById(R.id.Map_view);
m_zoom.setIsZoomInEnabled(true);
m_zoom.setIsZoomOutEnabled(true);
//放大按钮
m_zoom.setOnZoomInClickListener(new OnClickListener(){
public void onClick(View v) {
m_mapControl.getMap().zoom(2);
m_mapControl.getMap().refresh();
}
});
//缩小按钮
m_zoom.setOnZoomOutClickListener(new OnClickListener(){
public void onClick(View v) {
m_mapControl.getMap().zoom(0.5);
m_mapControl.getMap().refresh();
}
});
m_mapControl.getMap().refresh();
}
}

运行时程序可以打开,但是出现黑屏,地图加载不出来
...全文
446 3 打赏 收藏 转发到动态 举报
写回复
用AI写文章
3 条回复
切换为时间正序
请发表友善的回复…
发表回复
DKchenliyuan 2017-07-17
  • 打赏
  • 举报
回复
用网上的很多方法都尝试过,GPU啊什么的,还是没用效果
DKchenliyuan 2017-07-17
  • 打赏
  • 举报
回复
花花绿绿的报错信息一条都看不懂,求大神解释下,怎么解决啊 超图提供的用户说明上,原封不动的代码就可以运行程序,但是我的出现了这个问题 jar包、配置许可都已经做了,想不出哪里出现过问题

80,348

社区成员

发帖
与我相关
我的任务
社区描述
移动平台 Android
androidandroid-studioandroidx 技术论坛(原bbs)
社区管理员
  • Android
  • yechaoa
  • 失落夏天
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧