I want to take input, a URL or just a website name like, www.google.com from EditText in Android and on user click on the Button to submit
Use this regex on your website validation
String WebUrl = "^((ftp|http|https):\\/\\/)?(www.)?(?!.*(ftp|http|https|www.))[a-zA-Z0-9_-]+(\\.[a-zA-Z]+)+((\\/)[\\w#]+)*(\\/\\w+\\?[a-zA-Z0-9_]+=\\w+(&[a-zA-Z0-9_]+=\\w+)*)?$";
//TODO for website validation
private boolean isValidate()
{
String website = txtWebsite.getText().toString().trim();
if (website.trim().length() > 0) {
if (!website.matches(WebUrl)) {
//validation msg
return false;
}
}
return true;
}