I just basically want to switch to the number pad mode as soon a certain EditText has the focus.
android:windowSoftInputMode="stateAlwaysVisible" -> in manifest File. edittext. requestFocus(); -> in code. This will open soft keyboard on which edit-text has request focus as activity appears.
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 .
You can configure an inputType
for your EditText
:
<EditText android:inputType="number" ... />
To do it in a Java file:
EditText input = new EditText(this); input.setInputType(InputType.TYPE_CLASS_NUMBER);
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