0

I am working on a webview client app in Android Studio. I have a working splashscreen.

I want to check the internet connection, or check if the webpage is available. If not, then go to another activity than my webview activity.

GRuis
  • 1
  • 3

1 Answers1

0

You can do a simple thing load the webpage using custom WebViewClient overriding onPageError Method and starting The Activity in That Method.

class CustomWebViewClient extends WebViewClient(){ 
onReceivedError(WebView view, WebResourceRequest request, WebResourceError error){


startActivity(new Intent(this,Your_Second Activity.class));



   }}

And set WebView Client Like

webview.setWebViewClient(new CustomWebViewClient());
  • If this doesn't works try this link http://stackoverflow.com/questions/4238921/detect-whether-there-is-an-internet-connection-available-on-android?rq=1 – Technical People Apr 14 '17 at 13:06