"Couldn't open web page" WebView

Hello, such a problem: If there is no Internet connection, I try to take the page from the cache. (code below).

if ( !NetworkUtils.isDeviceOnline(this) ) { // loading offline
        settings.setCacheMode( WebSettings.LOAD_CACHE_ONLY );
    }

But if the page is not in the cache yet, then enter a description of the image here

How do I catch the creation of this page and change it to the one I need? (onReceivedError is not triggered)

Author: ManGust, 2017-01-18

1 answers

Now there are 2 onReceivedError methods. I did not go into the details of what for, but for some reason the error is picked up by the one that is not supported already. Not supported, but it works and catches the events I need to replace the html page.

P.S. once again I want to remind (myself in particular) that instead of view. loadData() it is better to use view. loadDataWithBaseURL. Otherwise, there are problems with the encoding.

 1
Author: ManGust, 2017-01-22 05:01:37