How to detect hyperlink click in a webview android with C#
November 28, 2013 by Anuraj
.Net .Net 3.0 / 3.5 Xamarin
This post is about detecting hyperlink click in a Android webview with C#. This can be useful in two scenarios.
- You need to open an activity when user clicks on some hyperlink
- You need to do something when user clicks on some hyper link.
You can achieve this by overriding the ShouldOverrideUrlLoading() method of WebViewClient class.
Here is the implementation. In this code, my web application contains a special hyperlink with “home” protocol, if user clicks on the link, I need to show the Main activity, else user need to navigate to the required url.
Happy Programming :)
Copyright © 2024 Anuraj. Blog content licensed under the Creative Commons CC BY 2.5 | Unless otherwise stated or granted, code samples licensed under the MIT license. This is a personal blog. The opinions expressed here represent my own and not those of my employer. Powered by Jekyll. Hosted with ❤ by GitHub