android中判断一个链接是否是有效的
private boolean isValid(String urlString) { try { URL url = new URL(urlString); return URLUtil.isValidUrl(urlString) && Patterns.WEB_URL.matcher(urlString).matches(); } catch (MalformedURLException e) { } return false; }
private boolean isValid(String urlString) { try { URL url = new URL(urlString); return URLUtil.isValidUrl(urlString) && Patterns.WEB_URL.matcher(urlString).matches(); } catch (MalformedURLException e) { } return false; }