How do I show the number keyboard on an EditText in android?


Question

I just basically want to switch to the number pad mode as soon a certain EditText has the focus.

1
142
3/20/2014 3:12:19 AM

Accepted Answer

You can configure an inputType for your EditText:

<EditText android:inputType="number" ... />
253
7/13/2009 6:46:06 PM

To do it in a Java file:

EditText input = new EditText(this);
input.setInputType(InputType.TYPE_CLASS_NUMBER);

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