После изменения с android.preference
на androidx.preference
мои ListPreferences происходит сбой диалогов (см. Трассировку стека ниже).
Вот мой xml (сокращенный):
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:title="@string/settings">
<androidx.preference.PreferenceCategory
android:key="preference_category_ui"
android:title="@string/preference_category_ui"
app:iconSpaceReserved="false">
<androidx.preference.ListPreference
android:defaultValue="dark"
android:dialogTitle="@string/theme_title"
android:entries="@array/themes_entries"
android:entryValues="@array/themes_values"
android:key="theme"
android:title="@string/theme_title"
app:iconSpaceReserved="false" />
</androidx.preference.PreferenceCategory>
</androidx.preference.PreferenceScreen>
Мои Настройки не имеют значков. Активность и Фрагмент созданы, но при нажатии на любую ListPreference я получаю это исключение:
android.content.res.Resources$NotFoundException: Resource ID #0x0
at android.content.res.ResourcesImpl.getValue(ResourcesImpl.java:216)
at android.content.res.Resources.loadXmlResourceParser(Resources.java:2155)
at android.content.res.Resources.getLayout(Resources.java:1155)
at android.view.LayoutInflater.inflate(LayoutInflater.java:421)
at android.view.LayoutInflater.inflate(LayoutInflater.java:374)
at androidx.appcompat.app.AlertController$AlertParams.createListView(AlertController.java:989)
at androidx.appcompat.app.AlertController$AlertParams.apply(AlertController.java:965)
at androidx.appcompat.app.AlertDialog$Builder.create(AlertDialog.java:984)
at androidx.preference.PreferenceDialogFragmentCompat.onCreateDialog(PreferenceDialogFragmentCompat.java:158)
at androidx.fragment.app.DialogFragment.onGetLayoutInflater(DialogFragment.java:403)
at androidx.fragment.app.Fragment.performGetLayoutInflater(Fragment.java:1484)
at androidx.fragment.app.FragmentStateManager.createView(FragmentStateManager.java:320)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1187)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1356)
at androidx.fragment.app.FragmentManager.moveFragmentToExpectedState(FragmentManager.java:1434)
at androidx.fragment.app.FragmentManager.moveToState(FragmentManager.java:1497)
at androidx.fragment.app.BackStackRecord.executeOps(BackStackRecord.java:447)
at androidx.fragment.app.FragmentManager.executeOps(FragmentManager.java:2169)
at androidx.fragment.app.FragmentManager.executeOpsTogether(FragmentManager.java:1992)
at androidx.fragment.app.FragmentManager.removeRedundantOperationsAndExecute(FragmentManager.java:1947)
at androidx.fragment.app.FragmentManager.execPendingActions(FragmentManager.java:1849)
at androidx.fragment.app.FragmentManager$4.run(FragmentManager.java:413)
at android.os.Handler.handleCallback(Handler.java:873)
at android.os.Handler.dispatchMessage(Handler.java:99)
at android.os.Looper.loop(Looper.java:193)
at android.app.ActivityThread.main(ActivityThread.java:6923)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:493)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:870)
Чего мне не хватает?