Wednesday, July 6, 2011

[android-developers] Can't get WebView timers to stop -> leak

Hi,

I have a WebView in my activity which loads some html pages which have
timers. I can see the timers continue running after exiting the
activity by logging WebViewClient.onLoadResource() statements.

I have tried calling resumeTimers() + pauseTimers() in my onResume() +
onPause() methods. Also tried putting an extra resumeTimers() call in
onCreate() as suggested in this same bug:

http://code.google.com/p/android/issues/detail?id=13991

The only way I can get the timers to stop is to load some dummy html
into my webview before the activity finishes:

protected void onPause() {
super.onPause();

if (isFinishing()) {
mWebView.loadData("<html></html>", "text/html", "utf-8");
}
}

Anyone else experiencing this?

Thanks

--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to android-developers@googlegroups.com
To unsubscribe from this group, send email to
android-developers+unsubscribe@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en

No comments:

Post a Comment