标签:
一般是在 Activity 的 OnDestroy 中处理 webView,代码如下:
public void onDestroy() {
super.onDestroy();
if (webView != null)
webView.destroy();
}
但会出现错误:Error: WebView.destroy() called while still attached
解决方法如下:
public void onDestroy() {
if (webView != null) {
ViewGroup parent = (ViewGroup) webView.getParent();
if (parent != null) {
parent.removeView(webView);
}
webView.removeAllViews();
webView.destroy();
}
super.onDestroy();
}
}
Error: WebView.destroy() called while still attached 解决方法
标签:
原文地址:http://www.cnblogs.com/scorpio0920/p/4186534.html