public void showWebSite(View view){ String url = urlText.getText().toString().trim(); if(!Patterns.WEB_URL.matcher(url).matches()){ urlText.setError("Invalid URL"); } else{ if(!url.startsWith("http://") && !url.startsWith("https://")){ url = "http://" + url; } myWebView.loadUrl(url); } }