Back

android - webview 退出时,让其中的 flash, video 停止播放的办法: onDestroy

发布时间: 2017-04-17 22:42:00

如下:

把这个放到activity中:

@Override
protected void onDestroy() {
  super.onDestroy();
  // 找到这个 webview
  final WebView webview = (WebView)findViewById(R.id.webPlayer);
  // 加载一个空的url 或者content即可。
  webview.loadData("", "text/html", "utf-8");
}

Back