1

I am using android webview and loading an url. Inside the webview, there are certain click events and on clicking , the UI inside webview is changed. I am not getting any callback in shouldOverrideUrlLoading(...). Is there a way to detect the changes inside webview in android?

The shouldOverrideUrlLoading() is called only when baseUrl changes.

abhishek maharajpet
  • 482
  • 1
  • 4
  • 18
  • Please check this.https://stackoverflow.com/questions/5116909/how-can-i-get-onclick-event-on-webview-in-android – Rafiq Ahmad Mar 04 '19 at 07:04
  • Thank you Rafiq, But that was not a reliable way to implement the requirement. I have an Url like "xxxxx/dasboard", which changes to "xxxxx/feedback" on clicking. I have tried to detect Url change using the link https://stackoverflow.com/questions/9312499/android-detect-webview-url-change but did not find a solution. – abhishek maharajpet Mar 04 '19 at 08:02

1 Answers1

1

The onPageFinished(WebView view, String url) method is called when every url changes and loads. The Url can be parsed to find out the change.

abhishek maharajpet
  • 482
  • 1
  • 4
  • 18
  • 1
    Single page applications do not provide callbacks for every URL change. Hence need to check the "onProgressChanged(Webview view, int progress)" in WebChromeClient to get all URL changes. – abhishek maharajpet Apr 29 '19 at 07:02