ClassCastException From A PreferenceActivity
I'm getting a classCastException every time I try to use this preference class, and I can't figure out why. Any help would be much appreciated. The line the crashes is the addPrefe
Solution 1:
The top element of the xml file should be PreferenceScreen not Preference
<?xml version="1.0" encoding="utf-8"?>
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<CheckBoxPreference
android:key="pref_sync"
android:title="@string/pref_sync"
android:summary="@string/pref_sync_summ"
android:defaultValue="true" />
<ListPreference
android:dependency="pref_sync"
android:key="pref_syncConnectionType"
android:title="@string/pref_syncConnectionType"
android:dialogTitle="@string/pref_syncConnectionType"
android:entries="@array/pref_syncConnectionTypes_entries"
android:entryValues="@array/pref_syncConnectionTypes_values"
android:defaultValue="@string/pref_syncConnectionTypes_default" />
</PreferenceScreen>
Extracted from the settings documentation
Post a Comment for "ClassCastException From A PreferenceActivity"