EditText with numeric keyboard and comma


I want to have EditTextPreference that accepts my pattern that consists of digits, comma and dash. My InputFilter works well with standard keyboard but I do not want standard but numeric keyboard. I can display it but only digits can be typed - dash and comma has no effect. How can I have numeric keyboard with digits, dash and comma? I tried all numeric* input types.

InputFilter[] filters = {new ValuesInputFilter()};
EditText editText = ((EditTextPreference) findPreference(KEY)).getEditText();
editText.setFilters(filters);

<EditTextPreference
    android:key="pref"
    android:inputType="number"
    android:summary="%s"
/>

enter image description here


Answers:


InputType phone was the closest I could find when implementing something like this.

The fallback is to create your own numerical keyboard, it becomes quite simple as it's 10 buttons plus backspace/accept depending on your requirements. This is what I did when creating a pin entry screen for a banking application.