I am trying to create a preferenceScreen with this command
PreferenceScreen screen= (PreferenceScreen)getPreferenceScreen().findPreference(KEY);
and the error message is: "inconvertible types, cannot cast android.support.v7.preference.Preference to android.preference.preferenceScreen"
Is there a way to fix it? Thanks!
Update: this is part of the testing code I wrote
ArrayList<String> cmds = new ArrayList<String>() {{
add("A");
add("B");
add("C");
}};
for (String cmd : cmds) {
CheckBoxPreference cpref = new CheckBoxPreference(getActivity().getApplicationContext());
cpref.setTitle(cmd);
cpref.setKey("The Name");
cpref.setChecked(true);
cmdScr.addPreference(cpref);
}
now the last line "addPreference" gives me an error