I have a simple preference (not EditText preference or ListPreference). I have a method that deletes all files in a directory. I want to do this when user clicks on a preference, but i don't know how to react to a click on a preference.
+1
A:
if your preference is stored in an object(togglePref
) you can do this
togglePref.setOnPreferenceClickListener(this);
then the event is:
@Override
public boolean onPreferenceClick(Preference preference) {
}
Pentium10
2010-06-21 14:37:39
+5
A:
getPreferenceManager().findPreference("pref_key").setOnPreferenceClickListener(new OnPreferenceClickListener()
{
@Override
public boolean onPreferenceClick(Preference preference)
{
// Do stuff here
}
});
CaseyB
2010-06-21 14:38:12
Tnx for you fast answer.
DixieFlatline
2010-06-22 07:58:34