How do you set EditText to only accept numeric values in Android?

Sourabh picture Sourabh · Jan 10, 2011 · Viewed 253.8k times · Source

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

Answer

Utyi picture Utyi · Jan 10, 2011

Add android:inputType="number" as an XML attribute.