Note that there are some explanatory texts on larger screens.

plurals
  1. POWebView threads never stop (WebViewCoreThread, CookieSyncManager, http[0-3])
    text
    copied!<p>I use a WebView to display some internet content on one of our app's Activities.<br> The problem is that when the user switches out of this activity, WebView's threads keep running!<br> The problematic threads are:</p> <pre><code>Thread [&lt;17&gt; WebViewCoreThread] (Running) Thread [&lt;25&gt; CookieSyncManager] (Running) Thread [&lt;19&gt; http0] (Running) Thread [&lt;29&gt; http1] (Running) Thread [&lt;31&gt; http2] (Running) Thread [&lt;33&gt; http3] (Running) </code></pre> <p>Pausing each one of these threads, and checking what it is busy doing:</p> <pre><code>Thread [&lt;17&gt; WebViewCoreThread] (Suspended) Object.wait(long, int) line: not available [native method] MessageQueue(Object).wait() line: 288 MessageQueue.next() line: 148 Looper.loop() line: 110 WebViewCore$WebCoreThread.run() line: 471 Thread.run() line: 1060 Thread [&lt;25&gt; CookieSyncManager] (Suspended) Object.wait(long, int) line: not available [native method] MessageQueue(Object).wait(long) line: 326 MessageQueue.next() line: 144 Looper.loop() line: 110 CookieSyncManager(WebSyncManager).run() line: 90 Thread.run() line: 1060 Thread [&lt;19&gt; http0] (Suspended) Object.wait(long, int) line: not available [native method] RequestQueue(Object).wait() line: 288 ConnectionThread.run() line: 93 </code></pre> <p>I wonder how can I tell the <code>Looper</code> in each of those threads to quit.</p> <p>I tried calling <code>webView.destroy()</code> in the activity's <code>onPause()</code> method, but it had no influence.<br> When I disable the call for opening a web page in the webView ( <code>webView.loadUrl(...)</code> ), those threads naturally are not started, and therefore don't stay on after leaving the activity.</p> <p>Any ideas as to how I can make <code>WebView</code>'s threads stop after leaving their activity?</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload