Deprecated: How to Specify Numeric Input Method in an EditText
Deprecated in API Level 3, added in API Level 1Use inputType instead.
(In a TextView, this the text will highlight while you are touching(press and hold) the TextView.
1. Create an Android project, if you don't already have one.
3. In the main.xml file, add the code below.
numeric = "integer"
This will bring up the number keypad for input entry. Nothing other than number entry is allowed.
Instead use, android:inputType = "number"
numeric = "signed"
This will bring up the number keypad for input entry. Nothing other than number entry is allowed. (A $ sign was now allowed because it was not on the keypad.)
Instead use, android:inputType = "numberSigned"
numeric = "decimal"
This will bring up the number keypad for input entry. A number or a decimal is allowed.
Instead use, android:inputType = "numberDecimal"
<EditText
...android:numeric = "integer"
/>
4. Compile and run!
http://developer.android.com/reference/android/widget/TextView.html#attr_android:numeric
http://developer.android.com/reference/android/R.attr.html#numeric