java - Prevent WebView from displaying "web page not available" -


i have app makes extensive use of webview. when user of app not have internet connection, page saying "web page not available" , various other text appears. there way not show generic text in webview? provide own error handling.

private final activity activity = this;  private class mywebviewclient extends webviewclient  public void onreceivederror(webview view, int errorcode, string description, string failingurl) {   // need this:   activity.webview.wipeoutthepage();   activity.mycustomerrorhandling();   toast.maketext(activity, description, toast.length_long).show();  } } 

i found out webview->clearview doesn't clear view.

first create own error page in html , put in assets folder, let's call myerrorpage.html onreceivederror:

mwebview.setwebviewclient(new webviewclient() {     public void onreceivederror(webview view, int errorcode, string description, string failingurl) {         mwebview.loadurl("file:///android_asset/myerrorpage.html");      } }); 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -