Android listpreferences, how to save individual preference
-
29-10-2019 - |
Question
I have some list preferences, but I don't know how to save the individual values from the list. How do I do it? Here is what I have
http://i41.tinypic.com/dh4gvo.png
Preference customPref = (Preference) findPreference("notificationPref");
customPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
SharedPreferences customSharedPreference = getSharedPreferences(
"notifications", Activity.MODE_PRIVATE);
SharedPreferences.Editor editor = customSharedPreference
.edit();
editor.putString("notification",
"The preference has been clicked");
editor.commit();
return true;
}
});
my list click listener is only for the main item in the list preferences page, but not the items in the popup itself. How do I save the choice selected in the popup itself?
No correct solution
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow