Showing posts with label To Stop background running youtube video in android webview. Show all posts
Showing posts with label To Stop background running youtube video in android webview. Show all posts

Tuesday, August 19, 2014

How to Stop background running youtube video in android webview

 To Stop background running youtube video in android webview

Just Override the onPause() method like:

    @Override
    public void onPause() {
               super.onPause();
        try {
            Class.forName("android.webkit.WebView")
                    .getMethod("onPause", (Class[]) null)
                                .invoke(webV, (Object[]) null);

        } catch(ClassNotFoundException cnfe) {
          
        } catch(NoSuchMethodException nsme) {
          
        } catch(InvocationTargetException ite) {
          
        } catch (IllegalAccessException iae) {
          
        }
    }