In my application, I have the values:
<ListPreference
android:key="font_setting"
android:title="@string/font"
android:summary="%s"
android:entries="@array/font_list"
android:entryValues="@array/font_list_values"
android:dialogTitle="@string/choose_font" />
and data:
<string-array name="font_list">
<item>"Small"</item>
<item>"Medium"</item>
<item>"Big"</item>
</string-array>
<integer-array name="font_list_values">
<item>1</item>
<item>2</item>
<item>3</item>
</integer-array>
but when I select one value, the application crashes, an error appears:
java.lang.NullPointerException
at android.preference.ListPreference.onDialogClosed(ListPreference.java:264)
I found that this is actually a very old problem raised here . And surprisingly, Google simply said that this is not a mistake, and there are no problems? Anyone have any suggestions?
This is tested in Android version 4.0.
source
share