Answers for "shouldoverrideurlloading kotlin"

0

shouldoverrideurlloading kotlin

override fun shouldOverrideUrlLoading(view: WebView, url: String): Boolean {
        if (Uri.parse(url).host == getString(R.string.website_domain)) {
            return false
        }
        val intent = Intent(Intent.ACTION_VIEW, Uri.parse(url))
        startActivity(intent)
        return true
    }

    override fun onPageFinished(view: WebView, url: String) {
        // TODO Auto-generated method stub
        super.onPageFinished(view, url)
    }

}

override fun onKeyDown(keyCode: Int, event: KeyEvent): Boolean {
    if (keyCode == KeyEvent.KEYCODE_BACK && webview.canGoBack()) {
        webview.goBack()
        return true
    }
    return super.onKeyDown(keyCode, event)
}
Posted by: Guest on May-29-2020

Browse Popular Code Answers by Language