4

how can add my own error page replacing default error page "webpage not available" when there no internet connection available. like below image https://i.stack.imgur.com/OgS7o.jpg

Vinod
  • 95
  • 1
  • 11

2 Answers2

4

i got solution by adding below code

mWebView.setWebViewClient(new MyWebViewClient()
  {
    public void onReceivedError(WebView webview, int i, String s, String s1)
  {
      mWebView.loadUrl("file:///android_asset/error.html");
  }
   });

put your own html error page in assets folder

Vinod
  • 95
  • 1
  • 11
0

Simply apply Broadcast receiver and register Network Connection event when event rising according to there status redirect your page.

Nikesh Pathak
  • 450
  • 2
  • 7
  • 18
  • check this link, http://www.vogella.com/tutorials/AndroidBroadcastReceiver/article.html and http://www.mkyong.com/android/android-webview-example/ – Nikesh Pathak Apr 24 '14 at 04:09