How to set only Integer numbers for EditText
? (I would like to avoid to user to put comma)
You can use android:inputType="number" in the XML file. You can specify other values such as numberDecimal as well. Also, you might additionally want to use android:singleLine="true" for a single line Edittext .
The keyboard actually has a full number pad layout too; unlike some keyboards, it's available in any app. To get the number pad, and tap the special character key in the lower left corner of the keyboard.
Just add a clarification: editText. setKeyListener(DigitsKeyListener. getInstance(true,true)); to enable decimals and negative numbers. editText.
The Best Answer is you have to used. String value= et. getText(). toString(); int finalValue=Integer.
Try below attribute in your xml:
android:inputType="numberSigned"
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With