How to webview return to the last url after playing video?
there is a webview with video links ,after finish playing a video in media player,the media player close and returns to webview ,but webview loads its original url instead of the url that I click the video link,I wander how to return to the last url after the media playe开发者_如何学编程r close? thx very much!
You can detect the url changes in your webview, setWebViewClient method of webview and then implement a new webViewClient, then you can access full url by using onPageFinished method. see code below.
webView.setWebViewClient(new WebViewClient()
{
@Override
public void onPageFinished(WebView view, String url)
{
//save url in a static variable so that this will ensure it will be the last url that will be loaded
}
});
精彩评论