I simply don't want users on my TV app to see the URL I'm using with the App when web page is unreachable. In that case they will get an error message with the URL:
"The webpage at http://example.com/action.php could not be loaded because: net::ERR_ADDRESS_UNREACHABLE" I tried to override fun onReceivedError as follows:
public class MyWebViewClient(activity: MainActivity) : WebViewClient() {
private val activity = activity
@SuppressWarnings("deprecation")
override fun onReceivedError(view: WebView?, errorCode: Int, description: String?, failingUrl: String?) {
//super.onReceivedError(view, errorCode, "No internet!", "failingUrl") //Here I supressed super.
Toast.makeText(activity, "onReceivedError! errorCode=$errorCode description: $description url: $failingUrl", Toast.LENGTH_LONG).show()
}
}
The Toast is displayed but the error message still displays, so I'm guessing there is some other function that I need to override. I am usin AVD (55" Android TV 1080p) with API 22 (Android 5.1)
What am I missing here? please advise, thank you.