Checking if string is web address or ip on android
问题 I need to validate if string entered in TextEdit is a web address eg. "www.stackoverflow.com" or an ip address eg. "64.34.119.12". I have tried this two methods without success. I have private class variable named ip. Method 1: public boolean isAdress(){ boolean isaddr = true; try { ip = new NetTask().execute(""+textEdit1.getText()).get(); } catch (Exception ex) { isaddr = false; } return isaddr; } Method 2 is the one were I check string before sending it to NetTask. public boolean isAdress()