I am experimenting with using a WebView to display Flash content inside my activity. Everything is working pretty well, but when the user hits the home key to put the activi
@Override
protected void onPause() {
super.onPause();
this.callHiddenWebViewMethod("onPause");
}
@Override
protected void onResume() {
super.onResume();
this.callHiddenWebViewMethod("onResume");
}
This is how you call it in your activity... Works like a charm.
I don't see where you see that BrowserActivity
or anything is calling pauseTimers()
. I do see where onPause()
for BrowserActivity
eventually routes to onPause()
of WebView
. However, onPause()
of WebView
has the @hide
annotation and so is not part of the SDK. Off the cuff, it would seem like onPause() is what you want, given the comment:
Call this to pause any extra processing associated with this view and its associated DOM/plugins/javascript/etc. For example, if the view is taken offscreen, this could be called to reduce unnecessary CPU and/or network traffic. When the view is again "active", call onResume().
Note the reference to "plugins", which is not mentioned in the pauseTimers()
documentation.
I'd try using reflection to see if onPause()
(and later onResume()
, when you want stuff to start up again) does what you need. If it does, please post an issue to b.android.com about this, asking them to add these methods (or equivalents) to the SDK. Your requirement seems like it will be a common one, and a solution that goes past the SDK is not a good solution.