現在、設定に を実装しようとしMultiSelectListPreference
ていますが、次のエラーが発生します。
E/ActivityThread: Failed to inflate
android.view.InflateException: Binary XML file line #18: Error inflating class java.lang.reflect.Constructor
at android.preference.GenericInflater.createItem(GenericInflater.java:397)
at android.preference.GenericInflater.onCreateItem(GenericInflater.java:417)
at android.preference.GenericInflater.createItemFromTag(GenericInflater.java:428)
at android.preference.GenericInflater.rInflate(GenericInflater.java:481)
at android.preference.GenericInflater.inflate(GenericInflater.java:326)
at android.preference.GenericInflater.inflate(GenericInflater.java:263)
at android.preference.PreferenceManager.inflateFromResource(PreferenceManager.java:269)
at android.preference.PreferenceFragment.addPreferencesFromResource(PreferenceFragment.java:285)
at com.mikebdev.refuel.SettingsActivity$SettingsFragment.onCreate(SettingsActivity.java:34)
at android.app.Fragment.performCreate(Fragment.java:1673)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:854)
at android.app.FragmentManagerImpl.moveToState(FragmentManager.java:1057)
at android.app.BackStackRecord.run(BackStackRecord.java:682)
at android.app.FragmentManagerImpl.execPendingActions(FragmentManager.java:1435)
at android.app.Activity.performStart(Activity.java:5113)
at android.app.ActivityThread.performLaunchActivity(ActivityThread.java:2271)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2358)
at android.app.ActivityThread.access$600(ActivityThread.java:153)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1247)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5227)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:795)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:562)
at dalvik.system.NativeStart.main(Native Method)
Caused by: java.lang.reflect.InvocationTargetException
at java.lang.reflect.Constructor.constructNative(Native Method)
at java.lang.reflect.Constructor.newInstance(Constructor.java:417)
at android.preference.GenericInflater.createItem(GenericInflater.java:383)
... 26 more
Caused by: java.lang.NullPointerException
at android.content.res.AssetManager.getResourceTextArray(AssetManager.java:230)
at android.content.res.Resources.getTextArray(Resources.java:427)
at android.content.res.TypedArray.getTextArray(TypedArray.java:628)
at android.preference.MultiSelectListPreference.onGetDefaultValue(MultiSelectListPreference.java:211)
at android.preference.Preference.<init>(Preference.java:267)
at android.preference.DialogPreference.<init>(DialogPreference.java:69)
at android.preference.DialogPreference.<init>(DialogPreference.java:90)
at android.preference.MultiSelectListPreference.<init>(MultiSelectListPreference.java:49)
... 29 more
私のXMLは次のようになります。
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<ListPreference
android:defaultValue="@string/pref_amountUnit_default"
android:dialogTitle="@string/pref_amountUnit"
android:entries="@array/pref_amountUnit_entries"
android:entryValues="@array/pref_amountUnit_values"
android:key="pref_amountUnit"
android:summary="@string/pref_amountUnit_summary"
android:title="@string/pref_amountUnit"/>
<ListPreference
android:defaultValue="@string/pref_distanceUnit_default"
android:dialogTitle="@string/pref_distanceUnit"
android:entries="@array/pref_distanceUnit_entries"
android:entryValues="@array/pref_distanceUnit_values"
android:key="pref_distanceUnit"
android:summary="@string/pref_distanceUnit_summary"
android:title="@string/pref_distanceUnit"/>
<MultiSelectListPreference
android:key="pref_consumptionUnit"
android:title="@string/pref_consumptionUnit"
android:summary="@string/pref_consumptionUnit_summary"
android:dialogTitle="@string/pref_consumptionUnit"
android:entries="@array/pref_consumptionUnit_entries"
android:entryValues="@array/pref_consumptionUnit_values"
android:defaultValue="@string/pref_consumptionUnit_default"
/>
<EditTextPreference
android:defaultValue="@string/pref_moneyUnit_default"
android:dialogTitle="@string/pref_moneyUnit"
android:key="pref_moneyUnit"
android:summary="@string/pref_moneyUnit_summary"
android:title="@string/pref_moneyUnit"/>
</PreferenceScreen>
このエラーの原因がわかりません。あなたが私を正しい方向に向けてくれることを願っています