You can use android:inputType="number" in the XML file. You can also specify other values, such as numberDecimal.
Alternatively, you can optionally use android:singleLine="true" for a single line of Edittext .
Also check out android:numeric and android:maxLength . maxLength in particular can be useful for setting length limits.
Samar Feb 17 '12 at 19:49 2012-02-17 19:49
source share