Hi!
I wounder if there is some different way of validating EditText on android controlls.. Or should I use the regular java way of doing this?
Hi!
I wounder if there is some different way of validating EditText on android controlls.. Or should I use the regular java way of doing this?
Depending on what your requirements are, you can look at the android:inputType attribute. This can be quite a bit easier in some cases. For example, specifying android:inputType=number
will simply disallow non-numeric symbols from being entered into the EditText box.
What kind of validation are we taking about?
Numbers:
android:numeric="decimal"
Length:
android:maxLength="10"
You can also provide "hints" of what the valid data should be:
android:hint="@string/numberHint"