1

I am new to Android and Kotlin. When I create my own HTML page. I include some links like

<a href='tel:8787878787'>Call our customer service</a>

Finally found ERR_UNKNOWN_URL_SCHEME error. I found the answer here in Java.

Android WebView err_unknown_url_scheme

But I want in Kotlin.

Please help

Athira Reddy
  • 1,004
  • 14
  • 18

1 Answers1

0
webViewFeed.webViewClient=object : WebViewClient(){
    override fun shouldOverrideUrlLoading(view: WebView?, url: String?): Boolean {
        if (URLUtil.isNetworkUrl(url)) {
            return false
        }
       else {
            val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
            startActivity(intent)
        }
        return true
    }

}
Stefano Sansone
  • 2,377
  • 7
  • 20
  • 39
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-ask). – Community Sep 21 '21 at 00:25