This is probably a bug in the Preferences framework, but I'm not
particularly familiar with the API and the documentation is a little
sparse, so I thought I'd check first...
Is there a restriction on the strings that can be used in the
entryValues array for a ListPreference?
I define the following two arrays:
<array name="pref_delay_entries">
<item>30 minutes</item>
<item>1 hour</item>
<item>2 hours</item>
<item>4 hours</item>
<item>12 hours</item>
<item>day</item>
</array>
<array name="pref_delay_values">
<item>1800000</item>
<item>3600000</item>
<item>7200000</item>
<item>14400000</item>
<item>43200000</item>
<item>86400000</item>
</array>
For use in the following ListPreference:
<ListPreference
android:key="delay"
android:defaultValue="3600000"
android:title="@string/pref_delay_title"
android:summary="@string/pref_delay_summary"
android:entries="@array/pref_delay_entries"
android:entryValues="@array/pref_delay_values"
android:dialogTitle="@string/pref_delay_dialog_title"
/>
That's it, very simple. Running my PreferenceActivity and attempting
to open the dialog (SDK 0.9 beta) results in the following exception:
java.lang.NullPointerException
at
android.preference.ListPreference.findIndexOfValue(ListPreference.java:
169)
at android.preference.ListPreference.getValueIndex(ListPreference.java:
178)
at
android.preference.ListPreference.onPrepareDialogBuilder(ListPreference.java:
190)
at
android.preference.DialogPreference.showDialog(DialogPreference.java:
289)
at android.preference.DialogPreference.onClick(DialogPreference.java:
260)
at android.preference.Preference.performClick(Preference.java:804)
at
android.preference.PreferenceScreen.onItemClick(PreferenceScreen.java:
182)
...
Changing the elements of the pref_delay_values to something other than
numbers removes the exception.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---