I've used this but this is not what I want. Since I have only one privacy policy webpage to show there is no use of canGoBack() and it closes the app on back press. I want to just close the webView.
override fun onBackPressed() {
val webView= findViewById<WebView>(R.id.webView)
if (webView.canGoBack()){
webView.goBack()}
else{
super.onBackPressed();
}
So if you have any solution in Kotlin please help!!