Android NumberPicker with Formatter doesn’t format on first rendering

dgel’s solution doesn’t work for me: when I tap on the picker, formatting disappears again. This bug is caused by input filter set on EditText inside NumberPicker when setDisplayValues isn’t used. So I came up with this workaround:

Field f = NumberPicker.class.getDeclaredField("mInputText");
EditText inputText = (EditText)f.get(mPicker);
inputText.setFilters(new InputFilter[0]);

Leave a Comment