java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more.

这个错误今天碰到了,下面是解决方法,直接上代码

在PhotoViewAttacher  文件中 更改cleanup方法
 
发现可行
     /*
* @SuppressWarnings("deprecation")
* public final void cleanup() {
* if (null!= mImageView) {
* mImageView.get().getViewTreeObserver().removeGlobalOnLayoutListener(this);
* }
* mViewTreeObserver = null;
*
* // Clear
* listeners too mMatrixChangeListener = null;
* mPhotoTapListener = null;
* mViewTapListener = null;
*
* // Finally, clear ImageView
* mImageView = null; }
*/
@SuppressWarnings("deprecation")
public final void cleanup() {
if (VERSION.SDK_INT >= VERSION_CODES.JELLY_BEAN) {
if (null != mImageView) {
mImageView.get().getViewTreeObserver()
.removeOnGlobalLayoutListener(this);
} if (null != mViewTreeObserver && mViewTreeObserver.isAlive()) {
mViewTreeObserver.removeOnGlobalLayoutListener(this); mViewTreeObserver = null; // Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
} } else {
if (null != mImageView) {
mImageView.get().getViewTreeObserver()
.removeGlobalOnLayoutListener(this);
} if (null != mViewTreeObserver && mViewTreeObserver.isAlive()) {
mViewTreeObserver.removeGlobalOnLayoutListener(this); mViewTreeObserver = null; // Clear listeners too
mMatrixChangeListener = null;
mPhotoTapListener = null;
mViewTapListener = null;
// Finally, clear ImageView
mImageView = null;
}
}
}

java.lang.IllegalStateException: ImageView no longer exists. You should not use this PhotoViewAttacher any more.的更多相关文章

  1. 云笔记项目- 上传文件报错"java.lang.IllegalStateException: File has been moved - cannot be read again"

    在做文件上传时,当写入上传的文件到文件时,会报错“java.lang.IllegalStateException: File has been moved - cannot be read again ...

  2. struts2 下载时报java.lang.IllegalStateException

    -----------------------------------------struts2 下载时报java.lang.IllegalStateException---------------- ...

  3. 异常java.lang.IllegalStateException的解决

    在初始化viewPagerAdapter时,显示异常.从网上找了找有两类这样的问题,一种是说给一个视图设置了两个父类,如: TextView tv = new TextView();layout.ad ...

  4. 开发问题及解决--java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

    <?xml version="1.0" encoding="utf-8"?> <ScrollView xmlns:android=" ...

  5. java.lang.IllegalStateException: Circular dependencies cannot exist in RelativeLayout

    <TextView android:layout_width="fill_parent" android:layout_height="wrap_content&q ...

  6. tomcat启动时检测到循环继承而栈溢出的问题:Caused by: java.lang.IllegalStateException: Unable to complete the scan for annotations for web application [/test] due to a StackOverflowError. Possible root causes include

    最近在公司更新一个老项目的时候,发现部署项目后tomcat报错,错误如下: Caused by: java.lang.IllegalStateException: Unable to complete ...

  7. myeclipse 无法启动 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).

    把myeclipse10 按照目录完整拷贝到了另外一台电脑, 另外的目录 原安装目录 D\:\soft\i\myeclipse10 新安装目录 E\:\soft\myeclipse10 双击启动失败, ...

  8. java.lang.IllegalStateException:Couldn't read row 0, col -1 from CursorWindow. Make sure the Cursor is initialized correctly before accessing data from it.

    java.lang.RuntimeException: Unable to start activity ComponentInfo{com.xxx...}: java.lang.IllegalSta ...

  9. java.lang.IllegalStateException: Not allowed to create transaction on shared EntityManager - use Spring transactions or EJB CMT instead

    java.lang.IllegalStateException: Not allowed to create transaction on sharedEntityManager - use Spri ...

随机推荐

  1. etcd集群日常维护

    配置文件和启动参数说明 命令行 | 配置文件 | 说明 data-dir | ETCD_DATA_DIR | 指定节点的数据存储目录,包括节点ID,集群ID,集群初始化配置,Snapshot文件,若未 ...

  2. OpenGL矩阵类(C++) 【转】

    http://www.cnblogs.com/hefee/p/3816727.html OpenGL矩阵类(C++) 概述 创建&初始化 存取器 矩阵运算 变换函数 实例:模型视图矩阵 实例: ...

  3. C#中 protected internal 和 internal 的区别

    http://kudick.blog.163.com/blog/static/1666066320091055414453/ DoDo: protected: 爷爷有一张银行卡,爸爸可以用,儿子也可以 ...

  4. SuperMap iClient如何使用WMTS地图服务(转)

    http://blog.sina.com.cn/s/blog_6259ebd50102v221.html 什么是WMTS服务 WMTS,切片地图Web服务(Web Map Tile Service)当 ...

  5. Filter及FilterChain的详解

    一.Filter的介绍及使用 什么是过滤器? 与Servlet相似,过滤器是一些web应用程序组件,可以绑定到一个web应用程序中.但是与其他web应用程序组件不同的是,过滤器是"链&quo ...

  6. Hive 性能调优

    避免执行MR select * or select field1,field2 limit 10 where语句中只有分区字段或该表的本地字段 使用本地set hive.exec.mode.local ...

  7. reduceByKey和groupByKey的区别

    先来看一下在PairRDDFunctions.scala文件中reduceByKey和groupByKey的源码 /** * Merge the values for each key using a ...

  8. 利用chrony和ntp搭建时间同步服务器

    利用chrony和ntp搭建时间同步服务器 环境说明 系统版本    CentOS 6.9 x86_64 Network Time Protocol(NTP,网络时间协议)用于同步它所有客户端时钟的服 ...

  9. VB程序无法运行,Component ‘MCI32.OCX’错误怎么办

    1 提示Component 'MCI32.OCX'错误   2 搜索你电脑的MCI32.OCX这个文件   3 把它复制到任意位置,然后再同一个目录下新建一个文本文档,输入regsvr32 MCI32 ...

  10. 【OpenGL 学习笔记01】HelloWorld演示样例

    <<OpenGL Programming Guide>>这本书是看了忘,忘了又看,赶脚还是把笔记做一做心里比較踏实,哈哈. 我的主题是,好记性不如烂笔头. ========== ...