Using webview.loadUrl(url)
method I open an url. If I click any Button
on the view it directs to another page. Now I want to get the url of the directed page. how can I get it?
I also want the content that is displayed on the webview. How to get the content of the WebView
?
this is the most simple way of handling this for API > 20: There are obviously other methods with parsers like HTMLCleaner to have more control. However, this is good and simple for getting URL. Each time URL changes in Webview, URL in the request object changes as well.
you can also make your call by overriding onpagefinished method of webviewclient. I wanted to note this, since this is called when page finishes loading.
please see my answer may it will help you...!!!!
I am assuming that you have set your
WebViewClient
.If not then you can do like below,Here when you click on any link on the
WebView
then it will callshouldOverrideUrlLoading()
and you can get the current url there incurrentUrl
.