I have an EditText with inputMode = text. By default software keyboard is shown as alphabetical and user have to switch it to numeric by pressing specific key (like "123").
Having text inputMode is it possible to show numeric keyboard by default instead of alphabetic?
I need both alphabetic and numeric. But numeric is used more often then alphabetic so i search for way to switch mode programmatically.
Just set it with the normal setter:
EditText editText = (EditText) findViewById(R.id.edittext);
editText.setInputType(InputType.TYPE_CLASS_NUMBER);
// or
editText.setInputType(InputType.TYPE_CLASS_TEXT);
I find the answer a day, finally I found this and its work.
android:inputType="textVisiblePassword"
source
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