Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to set only integer numbers for EditText android (without comma)

How to set only Integer numbers for EditText ? (I would like to avoid to user to put comma)

like image 672
wawanopoulos Avatar asked Jun 11 '14 10:06

wawanopoulos


People also ask

How can add only numbers in editText in android?

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 .

How do I get my keyboard to only show numbers on android?

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.

How do I set editText digits programmatically?

Just add a clarification: editText. setKeyListener(DigitsKeyListener. getInstance(true,true)); to enable decimals and negative numbers. editText.

How can I change text to INT in Android Studio?

The Best Answer is you have to used. String value= et. getText(). toString(); int finalValue=Integer.


1 Answers

Try below attribute in your xml:

android:inputType="numberSigned"
like image 122
Pratik Dasa Avatar answered Sep 20 '22 11:09

Pratik Dasa