JavaScript functions unable to call from Native Android


Even I have defined Android as a javascripinterface

webView.addJavascriptInterface(this, "Android");

I am using kotlin btw.

my .html file that I have loaded in a view.

<input type="button" onclick="showAndroidToast('Hello Android')" value="Hello"/>
<script type="text/javascript">
function showAndroidToast(toast) {
    if(typeof Android !== "undefined" && Android !== null) {
    } else {
        alert("Not viewing in webview");


I have setted webview settings

    webview.settings.javaScriptEnabled = true

    //Set whether the DOM storage API is enabled.
    webview.settings.domStorageEnabled = true

    //setBuiltInZoomControls = false, removes +/- controls on screen
    webview.settings.builtInZoomControls = false

    webview.settings.allowFileAccess = true


    jsHandler = JsHandler(this@UserRegistrationActivity,webview)
    webview.webChromeClient = object :WebChromeClient(){
        override fun onConsoleMessage(cm: ConsoleMessage?): Boolean {

            Log.d("CONTENT", String.format("%s @ %d: %s",
                    cm?.message(), cm?.lineNumber(), cm?.sourceId()));

            return true
    webview.webViewClient = object : WebViewClient(){
        override fun onPageStarted(view: WebView?, url: String?, favicon: Bitmap?) {
            super.onPageStarted(view, url, favicon)

        override fun onPageFinished(view: WebView?, url: String?) {
            super.onPageFinished(view, url)

        override fun onReceivedSslError(view: WebView?, handler: SslErrorHandler?, error: SslError?) {
            super.onReceivedSslError(view, handler, error)
    webview.settings.cacheMode = WebSettings.LOAD_NO_CACHE


I am not sure about it if anyone can help
Thanks in Advance