0

This is my code ERROR - " Type mismatch: inferred type is Unit but Boolean was expected "

webview2.setOnKeyListener(View.OnKeyListener {

   fun onKey( int: Int, event: KeyEvent): Boolean {
        if (event.action == KeyEvent.ACTION_DOWN){
            if(int == event.keyCode){
                if( webview2!=null){
                    if (webview2.canGoBack()){
                        webview2.goBack()
                    } else{
                        activity?.onBackPressed()
                    }
                }
            }
        }
       return true;
   }
})
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. – Community Jan 20 '22 at 18:47
  • Hi there I want to enable go back functionality in webview in kotlin but this code isnt working. Can you please help? – Jyotiraditya Jan 27 '22 at 07:06

0 Answers0