After trying and searching on stackoverflow for ways to solve internet connection error on android, I found nothing what works for me. I tryed the code you can see at the bottom but it wont works for internet connection error. mWebView.loadUrl("file:///android_asset/myerrorpage.html"); become executed every time when the url in the browser isnt http://192./loc/index.php. When I have a redirecting at index.php the error file become showed. How can I change that, or know anyone a code that check the internet connection availability and then do something?
    public boolean isOnline() {
            ConnectivityManager cm =
                (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
            NetworkInfo netInfo = cm.getActiveNetworkInfo();
            return netInfo != null && netInfo.isConnectedOrConnecting();
        }
    public boolean isInternetAvailable() {
            try {
                InetAddress ipAddr = InetAddress.getByName("google.com"); 
                if (ipAddr.equals("")) {
                    return false;
 mWebView.loadUrl("file:///android_asset/myerrorpage.html");
                } else {
                    return true;
@Override
        public void onCreate(Bundle savedInstanceState) {
            setContentView(R.layout.activity_localy);
            mWebView = (WebView) findViewById(R.id.webview);
            // Brower niceties -- pinch / zoom, follow links in place
            mWebView.getSettings().setJavaScriptCanOpenWindowsAutomatically(true);
            mWebView.setWebViewClient(new GeoWebViewClient());
            // Below required for geolocation
            mWebView.getSettings().setJavaScriptEnabled(true);
            mWebView.getSettings().setGeolocationEnabled(true);
            mWebView.setWebChromeClient(new GeoWebChromeClient());     
            // Load google.com
            mWebView.loadUrl("http://192./loc/index.php");
        }
                }
            } catch (Exception e) {
                return false;
            }
        }
 
    