Search code examples
android-edittextandroid-inputtype

For edittext, Is it possible to use InputType.TYPE_CLASS_NUMBER and show only a numpad but allow letters?


Is it possible to display only a number pad like w/ InputType.TYPE_CLASS_NUMBER but accept letters and hyphens too?


Solution

  • Setting the edittext's key listener did the trick. editText.setKeyListener(DigitsKeyListener.getInstance("0123456789.-abc......etc));