how to set only numeric value for edittext in android?


Question

I have an edittext in which I want only integer values to be inserted. Can somebody tell me which property I have to use?

1
194
7/20/2013 6:21:37 PM

Accepted Answer

I guess android:inputType="number" at the xml attributes.

385
1/4/2012 4:24:41 AM

For example:

<EditText
android:id="@+id/myNumber"
android:digits="0123456789."
android:inputType="numberDecimal"
/>

Licensed under: CC-BY-SA with attribution
Not affiliated with: Stack Overflow
Icon