看到论坛上有个网友和我一样的问题:

The map or layer has been destroyed or recyled

t

Hello,

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. 资源未释放的更多相关文章

  1. ArcGIS 图层旋转工具-arcgis案例实习教程

    ArcGIS 图层旋转工具-arcgis案例实习教程 联系方式:谢老师,135-4855-4328,xiexiaokui#qq.com 目的:对输入图层执行坐标旋转 使用方法:输入图层,旋转中心,旋转 ...

  2. ArcGIS for Desktop入门教程_第八章_Desktop学习资源 - ArcGIS知乎-新一代ArcGIS问答社区

    原文:ArcGIS for Desktop入门教程_第八章_Desktop学习资源 - ArcGIS知乎-新一代ArcGIS问答社区 1 学习资源 用户在学习和应用过程中,可以参考的资源如下: 1. ...

  3. ArcGIS Google Map 增加虚拟图层(MapImageLayer)(转载)

    <?xml version="1.0" encoding="utf-8"?> <s:Application xmlns:fx="ht ...

  4. ArcGIS Overview Map(鹰眼/概览图)

    一.说明 引用文件那块,可以参考我上一篇博文,arcgis api for javascript离线部署. 这篇博文中,地图占满整个body 二.运行效果 三.HTML代码 <!DOCTYPE ...

  5. 浮点型/小数/栅格图层转为整数型arcgis操作

    有时候会遇到将32位栅格数据提取属性表的操作,但是一般此类数据都是浮点型,是无法计算得到属性表的.因此我们可以利用数据管理工具下的: 复制栅格工具,在最下面选择16位即可,看自己数据情况选择signe ...

  6. arcgis jsapi接口入门系列(2):图层基础操作

    //图层相关demo layerFun: function () { //获取地图的所有图层(不包括的图层类型:底图图层(basemaps)) let layers = this.map.layers ...

  7. ArcGIS Server开发教程系列(7)使用ArcGIS API for Javascript-Hello World

    ArcGIS API for Javascript  API下载地址:http://support.esrichina-bj.cn/2011/0223/960.html 选择最新的下载就好了,目前是3 ...

  8. ArcGIS Wpf MarkerSymbol 图形符号无法序列化为 JSON

    [问题贴,尚不知如何解决] 在GraphicsLayer中添加一个点,使用自定义模板渲染该点,在Vs2012设计界面可以看到,但运行时出现异常 代码如下: <esri:Graphic x:Nam ...

  9. ElementLayer support not implemented for native rendering. Layer ID:

    在 arcgis runtime for wpf 添加标注闪烁动画时(实现方法参考:http://blog.csdn.net/arcgisserver_book/article/details/805 ...

随机推荐

  1. 让你的QT显示一个窗口吧

    项目文件 01_QtTest.pro #------------------------------------------------- # # Project created by QtCreat ...

  2. PHP代码优化—array_push

    PHP中数组插入数据通常有这么几种: 定义的时候直接赋值 $arr = array('apple', 'banana'); 使用数组变量操作 $arr = array(); $arr[] = 'app ...

  3. MS datatype define(微软数据类型定义)

    这里根据MS文档整理了微软数据类型的定义, 参考文档:https://docs.microsoft.com/zh-cn/openspecs/windows_protocols/ms-dtyp/2463 ...

  4. 控制 matplotlib 子图大小

    效果图: 代码: import numpy as np import matplotlib.pyplot as plt '''调整 matplotlib 子图的大小''' x1 = np.linspa ...

  5. P2167 [SDOI2009]Bill的挑战

    sb状压dp. 设f[i][j]表示字符串前i位和集合为j的串匹配的方案数. 枚举哪个字母直接转移就好了. (话说为啥这种水题都有紫色难度 #include<bits/stdc++.h> ...

  6. [BZOJ1974][SDOI2010]代码拍卖会[插板法]

    题意 询问有多少个数位为 \(n\) 的形如 \(11223333444589\) 的数位值不下降的数字在\(\mod p\) 的意义下同余 \(0\). $n\leq 10^{18} ,p\leq ...

  7. MYSQL创建表的约束条件(可选)

    一.常用的一些约束条件 一.创建表的完整语法1.创建表的万能模板:create table 库名.表名( 字段名1 类型[(宽度) 约束条件], 字段名2 类型[(宽度) 约束条件], 字段名3 类型 ...

  8. spark日志配置及问题排查方式。

    此文已由作者岳猛授权网易云社区发布. 欢迎访问网易云社区,了解更多网易技术产品运营经验. 任何时候日志都是定位问题的关键,spark也不会例外,合适的配置和获取spark的driver,am,及exe ...

  9. 第一阶段·Linux运维基础-第1章·Linux基础及入门介绍

    01-课程介绍-学习流程 02-服务器硬件-详解 03-服务器核心硬件-服务器型号-电源-CPU 01-课程介绍-学习流程 1.1. 光看不练,等于白干: 1.2 不看光练,思想怠慢: 1.3 即看又 ...

  10. Go语言2

    Go语言特点: 类型检查:编译时 运行环境:编译成机器代码直接运行 编程范式:面向接口,函数式编程,并发编程 Go并发编程 采用CSP(Communication Sequenication Proc ...