I'm building an android application and I have a pretty dumb question -
I've created a preference screen and put in it a list and a checkBox. Now I handled those just fine, using the 'key' attribute that is saved automatically.
My problem comes when I try using a simple Preference Item(they type that you just press it).
What is saved in SharedPreference
when it's clicked? If nothing, how can I catch the click event?
I can't find an answer anywhere. Thanks a lot!
tofira,
You need to use setOnPreferenceClickListener()
for that particular item. See example:
Preference myPref = (Preference) findPreference("myPref");
myPref.setOnPreferenceClickListener(new OnPreferenceClickListener() {
public boolean onPreferenceClick(Preference preference) {
//handle action on click here
}
});
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With