WebView doesn't seem to get destroyed after leaving activity?
<p>I've got an activity with a webview. Looks like the webview does not get destroyed along with the activity. To demonstrate, I've created an html page which runs a timer that loads an image resource every few seconds. The script continues executing after the activity is destroyed:</p>

<pre><code>public class MyWebViewActivity extends Activity {
  private WebView mWebView;

  @Override 
  public void onCreate(Bundle savedInstanceState) { 
    super.onCreate(savedInstanceState); 
    setContentView(R.layout.the_layout);

    mWebView = (WebView)findViewById(R.id.webview);
    mWebView.getSettings().setJavaScriptEnabled(true);
    mWebView.getSettings().setBuiltInZoomControls(true);
    mWebView.setWebViewClient(new EmbeddedWebViewClient());
    mWebView.loadUrl("test url");
  }

  private class EmbeddedWebViewClient extends WebViewClient {
    @Override
    public void onLoadResource(WebView view, String url) {
        super.onLoadResource(view, url);

        if (Config.DEBUG) { Log.v(TAG, "onLoadResource(): " + url); }
    }
  }
}
</code></pre>

<p>So the above just prints a log statement whenever onLoadResource() is called. Here's the javascript in the test html page:</p>

<pre><code>&lt;html&gt;
  &lt;head&gt;
    &lt;script type="text/javascript"&gt;

      function load() {
        setInterval("doit()", 3000);
      }

      function doit() {
        Image1 = new Image(150, 20);
        Image1.src = "abc_" + Math.floor(Math.random()*100) + ".png";
      }

    &lt;/script&gt;
  &lt;/head&gt;

  &lt;body onload="load()"&gt;
  &lt;/body&gt;
&lt;/html&gt;
</code></pre>

<p>The above just creates an image resource on the timer interval to trigger the onLoadResource() method in EmbeddedWebViewClient().</p>

<p>So yeah I can see in LogCat that the messages keep printing after leaving the activity. Do we have to shut down the WebView somehow? Maybe this is the issue described here:</p>

<p><a href="http://code.google.com/p/android/issues/detail?id=9375" rel="nofollow">http://code.google.com/p/android/issues/detail?id=9375</a></p>

<p>if it's a known issue should it have been documented in the api docs?</p>

<p>Note: Running this on android 2.3.4, Nexus S.</p>

<p>Thanks</p>
