WebView回收资源的报错的解决方案----Error: WebView.destroy() called while still attached!
来源:互联网 发布:张予曦真人好看吗 知乎 编辑:程序博客网 时间:2024/04/25 15:10
如题会出现这样的问题,一般是显示的在Activity的生命周期onDestroy方法里调用了WebView.destroy() 来回收销毁WebView对象造成的:
if (webView != null) {webView.clearCache(true);webView.removeAllViews(); webView.destroy();webView = null;}
首先我们来解释Error: WebView.destroy() called while still attached!错误的意思:
意思是webview对象还在父容器控件中引用,你就想调用destroy来销毁而报错。所以顾名思义我们得先解除这个引用,才能对webview对象进行回收销毁。
if (webView != null) {mLayoutContainer.removeView(webView);webView.clearCache(true);webView.removeAllViews();webView.destroy();webView = null;}
mLayoutContainer就是父容器控件,把webview对象从父容器中删除,就可以调用destroy来销毁了。
0 0
- WebView回收资源的报错的解决方案----Error: WebView.destroy() called while still attached!
- Error: WebView.destroy() called while still attached 的解决办法
- Error: WebView.destroy() called while still attached 的解决办法
- Error: WebView.destroy() called while still attached 的解决办法
- WebView.destroy()报错called while still attached
- WebView.destroy() called while still attached 的解决办法
- Android:Error: WebView.destroy() called while still attached
- Androd 错误解决--webview.destroy() called while still attached
- WebView called on thread 'JavaBridge'的问题和MediaPlayer stop called in state 1报错解决记录
- 关于WebView.destroy()崩溃的解决办法
- WebView.destroy()
- WebView的JavaScriptInterface调用startActive(),报错Uncaught Error: Error calling method on NPObjec
- WebView退出的时的报错
- Android 在使用webview报错 A WebView method was called on thread 'Thread-2599'
- WebView重定向的解决方案
- webview video全屏的解决方案
- Destroy WebView in Android
- Android小记-WebView的回收销毁
- mongodb集群shard中empty chunk的处理
- XML编码规则整理,值得收藏
- Nginx负载均衡
- nginx源码配置图解
- oozie-4.1.0 安装
- WebView回收资源的报错的解决方案----Error: WebView.destroy() called while still attached!
- Qt 3D的研究(四):指定渲染的材质以及效果
- ajax与后台交互
- 如何查看你的系统是legacy还是UEFI启动
- python学习笔记(1)基础知识
- 100道不错的算法面试题
- javascript深入理解 `闭包`
- 32位保护模式汇编语言[1]:实模式与保护模式的故事
- 校园视频学习总结