图层损坏 E/ArcGIS﹕ The map or layer has been destroyed or recycled. 资源未释放
看到论坛上有个网友和我一样的问题:
The map or layer has been destroyed or recyled

I have a problem when the app restores after the map activity has been destroyed by the system.
The system calles OnDestroy on it's own, which is fine, but then, when i open the app back, everything restores (the app
calles OnCreate again) except for the mapView Object.
When i try to add layers to the mapView i get the following message:
"The map or layer has been destroyed or recyled"
Does anybody had the same problem?
Any clues how to fix this?
-------------------------------------------------------------------------------------------------------
我这边的详细问题是:
地图的Activity onDestroy()后,在重新打开app的时候就报 The map or layer has been destroyed or recycled.错误,然后地图能显示
但是数据丢了..
原来的destroy()
- @Override
- protected void onDestroy() {
- featureLayers.clear();
- mMapView.destroyDrawingCache();
- try {
- unregisterReceiver(receiver);
- }
- catch (Exception e){
- e.printStackTrace();
- }
- try {
- unregisterReceiver(receiver2);
- }
- catch (Exception e){
- e.printStackTrace();
- }
- //结束服务,如果想让服务一直运行就注销此句
- try {
- stopService(new Intent(this, LocationService.class));
- }
- catch (Exception e){
- e.printStackTrace();
- }
- super.onDestroy();
- }
- //初始化数据图层
- private void initializeRoutingAndGeocoding() {
- for(int i=0;i<allfloor;i++) {
- Geodatabase geodatabase = null;
- try {
- geodatabase = new Geodatabase(geofilename[i]);
- List<GeodatabaseFeatureTable> table = geodatabase.getGeodatabaseTables();
- Log.i("zjx", "list:" + table);
- GeodatabaseFeatureTable mytable;
- if(i==1)mytable = geodatabase.getGeodatabaseFeatureTableByLayerId(0);
- else mytable= geodatabase.getGeodatabaseFeatureTableByLayerId(1);
- Log.i("zjx","mytable:"+mytable);
- featureLayers.add(new FeatureLayer(mytable)); //问题出在这
- // Attempt to load the local geocoding and routing data
- mMapView.addLayer(featureLayers.get(i)); //之前的资源没有释放(list.clear()),get(i)并不是新增的
- } catch (FileNotFoundException e) {
- // TODO Auto-generated catch block
- e.printStackTrace();
- }
- }
- trygetDataName();
- }
所以在onDestroy 里面加一下释放所有资源的函数,以前一直以为java会自己快速回收的= =
,
esri论坛sso不能登录,希望那个外国网友能看到这文章把~
版权声明:本文为博主原创文章,未经博主允许不得转载。
图层损坏 E/ArcGIS﹕ The map or layer has been destroyed or recycled. 资源未释放的更多相关文章
- ArcGIS 图层旋转工具-arcgis案例实习教程
ArcGIS 图层旋转工具-arcgis案例实习教程 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:对输入图层执行坐标旋转 使用方法:输入图层,旋转中心,旋转 ...
- ArcGIS for Desktop入门教程_第八章_Desktop学习资源 - ArcGIS知乎-新一代ArcGIS问答社区
原文:ArcGIS for Desktop入门教程_第八章_Desktop学习资源 - ArcGIS知乎-新一代ArcGIS问答社区 1 学习资源 用户在学习和应用过程中,可以参考的资源如下: 1. ...
- ArcGIS Google Map 增加虚拟图层(MapImageLayer)(转载)
<?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...
- ArcGIS Overview Map(鹰眼/概览图)
一.说明 引用文件那块,可以参考我上一篇博文,arcgis api for javascript离线部署. 这篇博文中,地图占满整个body 二.运行效果 三.HTML代码 <!DOCTYPE ...
- 浮点型/小数/栅格图层转为整数型arcgis操作
有时候会遇到将32位栅格数据提取属性表的操作,但是一般此类数据都是浮点型,是无法计算得到属性表的.因此我们可以利用数据管理工具下的: 复制栅格工具,在最下面选择16位即可,看自己数据情况选择signe ...
- arcgis jsapi接口入门系列(2):图层基础操作
//图层相关demo layerFun: function () { //获取地图的所有图层(不包括的图层类型:底图图层(basemaps)) let layers = this.map.layers ...
- ArcGIS Server开发教程系列(7)使用ArcGIS API for Javascript-Hello World
ArcGIS API for Javascript API下载地址:http://support.esrichina-bj.cn/2011/0223/960.html 选择最新的下载就好了,目前是3 ...
- ArcGIS Wpf MarkerSymbol 图形符号无法序列化为 JSON
[问题贴,尚不知如何解决] 在GraphicsLayer中添加一个点,使用自定义模板渲染该点,在Vs2012设计界面可以看到,但运行时出现异常 代码如下: <esri:Graphic x:Nam ...
- ElementLayer support not implemented for native rendering. Layer ID:
在 arcgis runtime for wpf 添加标注闪烁动画时(实现方法参考:http://blog.csdn.net/arcgisserver_book/article/details/805 ...
随机推荐
- 学习笔记——OS——引论
学习笔记--OS--引论 操作系统的定义 操作系统是一组管理计算机硬件资源的软件集合: 用户和计算机硬件之间的接口 控制和管理硬件资源 实现对计算机资源的抽象 计算机系统硬件 冯诺依曼体系结构和哈佛结 ...
- uboot-2012.04.01移植编译前准备
一:准备移植1.从下面的官网下载uboot-2012.04.012.建立sourceinsight工程 a.解压并在E:\colin weidongshan\transplant_u-boot-201 ...
- Golint的简易使用方法
根据作者的说法: Golint is a linter for Go source code. Golint differs from gofmt. Gofmt reformats Go source ...
- Scala的文件读写操作与正则表达式
目录 在本篇博客中你将会学习并了解常用的文件处理任务,例如读取文件的一行文本,本博客的要点包含: Source.fromFile(...).getLines.toArray 输出文件所有行 Sourc ...
- [转载]C#委托与事件--简单笔记
原文地址:https://www.cnblogs.com/joeymary/p/8486358.html 委托 简单记录点东西 适合似懂非懂的朋友看看委托类型用来定义和响应应用程序中的回调.借此可以设 ...
- 20145209刘一阳《JAVA程序设计》第九周课堂测试
第九周课堂测试 1.域名解析服务器(ARP)负责将域名转化为IP地址,从而与主机连接.(B) A .true B .false 2.下列关于URL类的说法,正确的是(BD) A .URL 类自身可根据 ...
- 【转载】COM 组件设计与应用(四)——简单调用组件
原文:http://vckbase.com/index.php/wv/1211.html 一.前言 同志们.朋友们.各位领导,大家好. VCKBASE 不得了, 网友众多文章好. 组件设计怎么学? 知 ...
- 解决table td里面长串数字或字母不换行的问题
在html中,经常要用到table标签,一般情况下,table下面的td元素里的东西都是汉字或者说是汉字.字母.数字的混合,在这种情况下,不设置table的宽度,也就是table宽度自适应的时候,浏览 ...
- 基于Cocos2d-x-1.0.1的飞机大战游戏迁移到Cocos2d-x-3.0版本,并移植到Android平台成功运行
一.版本迁移中的问题 1.游戏元素Sprite.Label.Action等等的创建函数名都改为create. 2.函数的回调callfunc_selectorcallfuncN_selectorcal ...
- 树莓派3b添加python时间同步脚本
树莓派没有电池,因此断电后系统时间会停止,直到你开机后又继续计时,所以会造成系统时间和实际时间有很大的误差. 因为项目需要用到本地时间,精度要求不高不想折腾(如果需要高精度,需要安装ntp),所以考虑 ...