Set edittext using only “,0123456789” programmatically in Android?
问题 My question is this. I can say in xml android:digits="0123456789," But this time I've to it add trough java code. customEditText.setKeyListener(DigitsKeyListener.getInstance("0123456789,")); Doesn't work. Application gives me same result as android:InputType="number" So is there any alternative way to say android:digits using java? EDITED So my question wasn't how to get android:InputType="number" using java. My question is that how I can get android:digits="0123456789," to be used with java.