Skip to content Skip to sidebar Skip to footer

Flash Video Keeps Playing Even After Back Button Is Pressed Android

So I've created a WebView and set the content to an html string like so (This gets called when a user presses a ListView Item): String html = '' + '

Solution 1:

For Honeycomb+ targets, you can add calls to the WebView's onPause() and onResume() in your activity's onPause() and onResume():

// assuming mWebView is assigned in onCreate() ..@OverridepublicvoidonPause() {
    super.onPause();
    mWebView.onPause();
}

@OverridepublicvoidonResume() {
    super.onResume();
    mWebView.onResume();
}

Alternatively (and since those methods are hidden for earlier targets), the following should work too:

@OverrideprotectedvoidonDestroy() {
    super.onDestroy();
    mWebView.loadUrl("about:blank");
}

Solution 2:

Above methods didn't work for me, I came across another post that did the business here.

try {
    Class.forName("android.webkit.WebView")
            .getMethod("onPause", (Class[]) null)
                        .invoke(webview, (Object[]) null);
} catch(Exception e) {}

Post a Comment for "Flash Video Keeps Playing Even After Back Button Is Pressed Android"