how would I get the same effect of having a phone keyboard with only digits which I would get using these xml attributes
android:inputType="phone"
android:digits="0123456789"
using Java and setInput
or setRawInput
?
Try programmatically like below:
editText.setInputType(InputType.TYPE_CLASS_PHONE);
editText.setKeyListener(DigitsKeyListener.getInstance("0123456789"));