Sometimes all we really need is to check if a URL is valid. You know, the standard "http(s)://domain.com/something/" pattern.
It took a while to find, but the API level 1 had it all along!
Just use URLUtil.isValidUrl() to test it.
// Validate URL
if (!URLUtil.isValidUrl(url)) {
Toast.makeText(this, "Invalid URL specified", Toast.LENGTH_SHORT).show();
return;
}
That's all folks!