开发者

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]*")

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜