@Override protected void onPause() { super.onPause(); try { if (mWebView != null) { mWebView.getClass().getMethod("onPause").invoke(mWebView, (Object[]) null); isOnPause = true; } } catch (Exception e) { e.printStackTrace(); } } @Override protected void onResume() { super.onResume(); try { if (isOnPause) { if (mWebView != null) { mWebView.getClass().getMethod("onResume").invoke(mWebView, (Object[]) null); } isOnPause = false; } } catch (Exception e) { e.printStackTrace(); } } @Override protected void onDestroy() { super.onDestroy(); if (mWebView != null) { mWebView.destroy(); mWebView = null; } isOnPause = false; }
退出Activity后,webview依然在播放音频视频
最新推荐文章于 2023-06-25 15:11:10 发布