开发者

How to ensure set type value in EditText to be only receive only int?

I want to calculate from 2 in开发者_StackOverflow社区put (2 EditText) which the value in EditText receive only int. How to code this?


Try adding android:numeric="decimal" to EditText


Use int myInt = Integer.parseInt("55"); Where 55 is the text that was entered in the edittext. If it is an integer in the text it will work; otherwise it will throw NumberFormatException if the string cannot be parsed as an integer value.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜