I have an EditTextPreference
in the settings of my app for which I only want to accept positive decimal numbers:
<EditTextPreference
android:key="annual_vacation_setting"
android:title="@string/enter_annual_vacation"
android:defaultValue="@string/default_annual_vacation"
android:inputType="numberDecimal"
android:selectAllOnFocus="true" />
Unfortunately, the inputType
attribute doesn't seem to have any effect. The user can input arbitrary strings.