I have several fields in my activity which all take integers, and integers only.
Looking around the SO here I see that the easiest way to perform validation is to simply declare an InputType of Integer in my layout.xml
This works fine. User can only enter numbers and my business logic is happy. It can also handle blank fields.
However, I was wondered is there any possible way a user can input a non numeric value? Do I need to be able to handle this? If the answer is yes then it means I will need to update all my unit tests along with the field validation in my application but would prefer to trust Android OS to do it.
I have several fields in my activity which all take integers, and integers only.
Share
If you use InputType correctly, the user won’t be able to enter any characters that are not specified by that InputType.