-1
Opa personal I am with a certain problem when I run a Destroy in a webview.
wb.getSettings().setAllowFileAccess(true);
wb.getSettings().setJavaScriptEnabled(true);
wb.getSettings().setRenderPriority(RenderPriority.HIGH);
wb.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE);
detail this only occurs when i Seto the Javascriptenable.
mWebContainer.removeView(wb);
wb.clearHistory();
wb.stopLoading();
wb.clearView();
wb.clearCache(true);
wb.destroyDrawingCache();
wb.setWebChromeClient(null);
wb.setWebViewClient(null);
wb.getSettings().setJavaScriptEnabled(false);
wb.removeAllViews();
wb.destroy();
I’ve tried almost everything to give Stroy without the mistake happening
04-02 13:34:14.893: E/webview(24263): java.lang.Throwable: Error: Webview.Destroy() called while still Attached! 04-02 13:34:14.893: E/webview(24263): at android.webkit.Webviewclassic.Destroy(Webviewclassic.java:2188) 04-02 13:34:14.893: E/webview(24263): at android.webkit.Webview.Destroy(Webview.java:647) 04-02 13:34:14.893: E/webview(24263): at android.view.View.performClick(View.java:4421) 04-02 13:34:14.893: E/webview(24263): at android.view.View$Performclick.run(View.java:17903) 04-02 13:34:14.893: E/webview(24263): at android.os.Handler.handleCallback(Handler.java:730) 04-02 13:34:14.893: E/webview(24263): at android.os.Handler.dispatchMessage(Handler.java:92) 04-02 13:34:14.893: E/webview(24263): at android.os.Looper.loop(Looper.java:213) 04-02 13:34:14.893: E/webview(24263): at android.app.Activitythread.main(Activitythread.java:5225) 04-02 13:34:14.893: E/webview(24263): at java.lang.reflect.Method.invokeNative(Native Method) 04-02 13:34:14.893: E/webview(24263): at java.lang.reflect.Method.invoke(Method.java:525) 04-02 13:34:14.893: E/webview(24263): at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:741) 04-02 13:34:14.893: E/webview(24263): at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:557) 04-02 13:34:14.893: E/webview(24263): at Dalvik.system.Nativestart.main(Native Method) 04-02 13:34:15.294: E/androidruntime(24263): FATAL EXCEPTION: main 04-02 13:34:15.294: E/androidruntime(24263): java.lang.Nullpointerexception 04-02 13:34:15.294: E/androidruntime(24263): at android.webkit.Zoommanager.onSizeChanged(Zoommanager.java:955) 04-02 13:34:15.294: E/androidruntime(24263): at android.webkit.Webviewclassic.onSizeChanged(Webviewclassic.java:5689) 04-02 13:34:15.294: E/androidruntime(24263): at android.webkit.Webview.onSizeChanged(Webview.java:2157) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.sizeChange(View.java:14582) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.setFrame(View.java:14557) 04-02 13:34:15.294: E/androidruntime(24263): at android.webkit.Webview.access$701(Webview.java:243) 04-02 13:34:15.294: E/androidruntime(24263): at android.webkit.Webview$Privateaccess.super_setFrame(Webview.java:1788) 04-02 13:34:15.294: E/Androidruntime(24263): at android.webkit.Webviewclassic.setFrame(Webviewclassic.java:5665) 04-02 13:34:15.294: E/androidruntime(24263): at android.webkit.Webview.setFrame(Webview.java:2151) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.layout(View.java:14468) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Viewgroup.layout(Viewgroup.java:4562) 04-02 13:34:15.294: E/androidruntime(24263): at android.widget.Relativelayout.onLayout(Relativelayout.java:1076) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.layout(View.java:14471) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Viewgroup.layout(Viewgroup.java:4562) 04-02 13:34:15.294: E/androidruntime(24263): at android.widget.Framelayout.onLayout(Framelayout.java:452) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.layout(View.java:14471) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Viewgroup.layout(Viewgroup.java:4562) 04-02 13:34:15.294: E/androidruntime(24263): at android.widget.Linearlayout.setChildFrame(Linearlayout.java:1671) 04-02 13:34:15.294: E/androidruntime(24263): at android.widget.Linearlayout.layoutVertical(Linearlayout.java:1525) 04-02 13:34:15.294: E/androidruntime(24263): at android.widget.Linearlayout.onLayout(Linearlayout.java:1434) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.layout(View.java:14471) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Viewgroup.layout(Viewgroup.java:4562) 04-02 13:34:15.294: E/androidruntime(24263): at android.widget.Framelayout.onLayout(Framelayout.java:452) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.View.layout(View.java:14471) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Viewgroup.layout(Viewgroup.java:4562) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.Viewrootimpl.performLayout(Viewrootimpl.java:1984) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.Viewrootimpl.performTraversals(Viewrootimpl.java:1738) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.Viewrootimpl.doTraversal(Viewrootimpl.java:1008) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Viewrootimpl$Traversalrunnable.run(Viewrootimpl.java:5508) 04-02 13:34:15.294: E/Androidruntime(24263): at android.view.Choreographer$Callbackrecord.run(Choreographer.java:749) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.Choreographer.doCallbacks(Choreographer.java:562) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.Choreographer.doFrame(Choreographer.java:532) 04-02 13:34:15.294: E/androidruntime(24263): at android.view.Choreographer$Framedisplayeventreceiver.run(Choreographer.java:735) 04-02 13:34:15.294: E/androidruntime(24263): at android.os.Handler.handleCallback(Handler.java:730) 04-02 13:34:15.294: E/androidruntime(24263): at android.os.Handler.dispatchMessage(Handler.java:92) 04-02 13:34:15.294: E/androidruntime(24263): at android.os.Looper.loop(Looper.java:213) 04-02 13:34:15.294: E/androidruntime(24263): at android.app.Activitythread.main(Activitythread.java:5225) 04-02 13:34:15.294: E/Androidruntime(24263): at java.lang.reflect.Method.invokeNative(Native Method) 04-02 13:34:15.294: E/Androidruntime(24263): at java.lang.reflect.Method.invoke(Method.java:525) 04-02 13:34:15.294: E/Androidruntime(24263): at com.android.Internal.os.Zygoteinit$Methodandargscaller.run(Zygoteinit.java:741) 04-02 13:34:15.294: E/Androidruntime(24263): at com.android.Internal.os.Zygoteinit.main(Zygoteinit.java:557) 04-02 13:34:15.294: E/androidruntime(24263): at Dalvik.system.Nativestart.main(Native Method)
Well I’ve tried removing it from the view, but the same error persists.
– JunioorCelistre
Tried to disable javascript before removing webview?
– Leonardo Otto
Yes, Wb.getSettings(). setJavaScriptEnabled(false); although it is not very recommended to do this I did and the error persists.
– JunioorCelistre
Where do you call Wb.Destroy()? Within which method?
– Leonardo Otto
Inside a click on a button
– JunioorCelistre
Which version of Android are you using? You can post xml and class?
– Leonardo Otto
Poxa Otto do not know why but my webView was inside a linear that was inside a relative so I took the linear I left only the relative and it worked but his example helped a lot VLWZÂO !!!
– JunioorCelistre