Editext validation for button click
I have an edittext and when the button is clicked 开发者_如何学编程it allows only Strings.
I do this by using an if statement to show a dialog with this condition: (str.matches("[0-9]*")
but when I enter this ttttt12323 and press the button it allows string and int to go through.
I want to put validation for not allowing string and text together specifically only Strings.
Can this be done. Thanks
So you want to check if your input consists of characters only, right?
You could try something like (str.matches("[A-Za-z]*")
精彩评论