3

Problem Statement: I have a view pager with pager adapter containing 4 fragments. In the last fragment, I have a webview dedicated to play you tube embed videos. When video is been played and I scroll the viewpager or I exit the app by pressing back button (as I have a single activity), Video doesnt stop in a webview. I have seen one answer at here. It doesn't work. But my question is even if it works, where should I put that onPause code of the webview? I have tried it in onPageScrolled method of pager adapter but it doesn't work there either. Any help is appreciated. TIA.

4

1 回答 1

1

你必须在你的片段中暂停你的 webview。不要忘记恢复它,否则它不会第二次工作:

@Override
public void onResume()
{
    super.onResume();
    mWebView.onResume();
}

@Override
public void onPause()
{
    super.onPause();
    mWebView.onPause();
}
于 2016-07-29T08:04:34.610 回答