Does anyone know if there is a way to intercept a "page not found" or "page not loading error" in WebView?
According to the android documentation, onReceivedError()
should be able to intercept. but i tested it in an app which I deleberately gave the wrong URL, and it didn't do anything.
I want my app to be able to give my own custom error message if the URL is ever unavailable for any reason.
this is the code that did nothing:
public void onReceivedError(WebView view, int errorCode,
String description, String failingUrl) {
// custom error handling ... show and alert or toast or something
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…