1

I'm overriding method shouldOverrideUrlLoading of WebViewClient, It works fine when phone is connected with internet, but it doesn't get call when internet is not connected. Can anyone explain what could be reason? I'm using android 4.4

Kundan Atre
  • 3,853
  • 5
  • 26
  • 39
  • If internet is not available then how your url load? Its simple. – Piyush Feb 12 '14 at 05:09
  • Yes Piyush, I understand. But it display standard error(i.e. check you device has internet connection ... ) in my App itself, rather I prefer to see this error on browser – Kundan Atre Feb 12 '14 at 05:43
  • why do you need the WebView at all then? Could you not create an Intent instead: http://stackoverflow.com/questions/2201917/how-can-i-open-a-url-in-androids-web-browser-from-my-application – marcin.kosiba Feb 12 '14 at 11:03

1 Answers1

1

It works fine when phone is connected with internet, but it doesn't get call when internet is not connected. Can anyone explain what could be reason?

  1. This method is not called for requests using the POST "method".
  2. and this execute when your URL is about to load. When device is not connected with internet then it does not load your URL.
N Sharma
  • 33,489
  • 95
  • 256
  • 444
  • Thanks Williams for reply, Actually my ultimate aim is to launch url on default browser of phone, so I'm overriding this method i.e. "shouldOverrideUrlLoading". When method returns true it is launching url on browser, but since in case of "NO internet" connection the method is not getting called and I'm unable to launch browser. Can you please tell me what could be possible alternative to launch browser, even if phone is not connected to internet. – Kundan Atre Feb 12 '14 at 05:36