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

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()

  1. @Override
  2. protected void onDestroy() {
  3. featureLayers.clear();
  4. mMapView.destroyDrawingCache();
  5. try {
  6. unregisterReceiver(receiver);
  7. }
  8. catch (Exception e){
  9. e.printStackTrace();
  10. }
  11. try {
  12. unregisterReceiver(receiver2);
  13. }
  14. catch (Exception e){
  15. e.printStackTrace();
  16. }
  17. //结束服务,如果想让服务一直运行就注销此句
  18. try {
  19. stopService(new Intent(this, LocationService.class));
  20. }
  21. catch (Exception e){
  22. e.printStackTrace();
  23. }
  24. super.onDestroy();
  25.  
  26. }
  1. //初始化数据图层
  2. private void initializeRoutingAndGeocoding() {
  3. for(int i=0;i<allfloor;i++) {
  4. Geodatabase geodatabase = null;
  5. try {
  6. geodatabase = new Geodatabase(geofilename[i]);
  7. List<GeodatabaseFeatureTable> table = geodatabase.getGeodatabaseTables();
  8. Log.i("zjx", "list:" + table);
  9.  
  10. GeodatabaseFeatureTable mytable;
  11. if(i==1)mytable = geodatabase.getGeodatabaseFeatureTableByLayerId(0);
  12. else mytable= geodatabase.getGeodatabaseFeatureTableByLayerId(1);
  13.  
  14. Log.i("zjx","mytable:"+mytable);
  15. featureLayers.add(new FeatureLayer(mytable)); //问题出在这
  16. // Attempt to load the local geocoding and routing data
  17. mMapView.addLayer(featureLayers.get(i)); //之前的资源没有释放(list.clear()),get(i)并不是新增的
  18. } catch (FileNotFoundException e) {
  19. // TODO Auto-generated catch block
  20. e.printStackTrace();
  21. }
  22. }
  23. trygetDataName();
  24. }

所以在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. 学习笔记——OS——引论

    学习笔记--OS--引论 操作系统的定义 操作系统是一组管理计算机硬件资源的软件集合: 用户和计算机硬件之间的接口 控制和管理硬件资源 实现对计算机资源的抽象 计算机系统硬件 冯诺依曼体系结构和哈佛结 ...

  2. uboot-2012.04.01移植编译前准备

    一:准备移植1.从下面的官网下载uboot-2012.04.012.建立sourceinsight工程 a.解压并在E:\colin weidongshan\transplant_u-boot-201 ...

  3. Golint的简易使用方法

    根据作者的说法: Golint is a linter for Go source code. Golint differs from gofmt. Gofmt reformats Go source ...

  4. Scala的文件读写操作与正则表达式

    目录 在本篇博客中你将会学习并了解常用的文件处理任务,例如读取文件的一行文本,本博客的要点包含: Source.fromFile(...).getLines.toArray 输出文件所有行 Sourc ...

  5. [转载]C#委托与事件--简单笔记

    原文地址:https://www.cnblogs.com/joeymary/p/8486358.html 委托 简单记录点东西 适合似懂非懂的朋友看看委托类型用来定义和响应应用程序中的回调.借此可以设 ...

  6. 20145209刘一阳《JAVA程序设计》第九周课堂测试

    第九周课堂测试 1.域名解析服务器(ARP)负责将域名转化为IP地址,从而与主机连接.(B) A .true B .false 2.下列关于URL类的说法,正确的是(BD) A .URL 类自身可根据 ...

  7. 【转载】COM 组件设计与应用(四)——简单调用组件

    原文:http://vckbase.com/index.php/wv/1211.html 一.前言 同志们.朋友们.各位领导,大家好. VCKBASE 不得了, 网友众多文章好. 组件设计怎么学? 知 ...

  8. 解决table td里面长串数字或字母不换行的问题

    在html中,经常要用到table标签,一般情况下,table下面的td元素里的东西都是汉字或者说是汉字.字母.数字的混合,在这种情况下,不设置table的宽度,也就是table宽度自适应的时候,浏览 ...

  9. 基于Cocos2d-x-1.0.1的飞机大战游戏迁移到Cocos2d-x-3.0版本,并移植到Android平台成功运行

    一.版本迁移中的问题 1.游戏元素Sprite.Label.Action等等的创建函数名都改为create. 2.函数的回调callfunc_selectorcallfuncN_selectorcal ...

  10. 树莓派3b添加python时间同步脚本

    树莓派没有电池,因此断电后系统时间会停止,直到你开机后又继续计时,所以会造成系统时间和实际时间有很大的误差. 因为项目需要用到本地时间,精度要求不高不想折腾(如果需要高精度,需要安装ntp),所以考虑 ...