How to throw Network errors in Android WebView?

132 views Asked by At

I am using Android WebView in my App.

I know that there is a method onReceivedError(final int errorCode, final String description, final String failingUrl) that gets triggered in WebViewClient

I know the WebView triggers it automatically when there is a Network issue such as FILE_NOT_FOUND, CONNECTION_REFUSED etc.

My question is.
Is there an Exception object I can throw which will trigger onReceiveError() method?

I need to test different scenarios like "Service is unavailable" etc.

0

There are 0 answers