Validating URLs in Android

This is mostly just a reminder for myself. This morning I was checking to see if there was a simple way to validate URLs in Android and low and behold there is:

From: http://twigstechtips.blogspot.com/2011/10/android-validate-url-string.html


// Validate URL
if (!URLUtil.isValidUrl(url)) {
Toast.makeText(this, "Invalid URL specified", Toast.LENGTH_SHORT).show();
return;
}

Source: URLUtil.isValidUrl()