Changing inputType of EditPreference

I want to change the inputType in my EditPreferences:

<PreferenceCategory android:title="Test" >
    <EditTextPreference
        android:key="@string/pref_delay"
        android:summary="Set the delay"
        android:title="preview_delay"
        android:defaultValue="13"
         />
</PreferenceCategory>

<PreferenceCategory android:title="Similarity List" >
    <EditTextPreference
        android:key="@string/pref_songcount"
        android:summary="Set the number of songs)"
        android:title="Songcount"
        android:defaultValue="10" />
    <EditTextPreference
        android:key="@string/pref_similarity"
        android:summary="Enter the minimum percentage"
        android:title="Similarity"
        android:defaultValue="0" />
</PreferenceCategory>

android:inputType="XYZ" is NOT working for EditPreferences.

How can I still do that?

Upvotes: 1

Views: 1132

Answers (2)

Ostkontentitan
Ostkontentitan

Reputation: 7010

EditPreferences is the wrong place for inputType. Put it into the EditTextPreference-blocks.

If you meaned that and it isnt working for you:

This would be the java-based way to set the EditTextPreferences InputType.

        EditTextPreference editTextPreference = findByViewId(R.id.editTextPrefId);
        EditText editText = editTextPreference.getEditText();
        editText.setInputType(InputType.TYPE_CLASS_TEXT);

Upvotes: 1

android:inputType works!

It is just not showing up in the auto-completion feature in eclipse.

Upvotes: 2

Related Questions