I have a list preference in one of my settings page. I want to perform an action whenever one of the values in the list is selected. However the onClick listener is not getting called when an item is selected. Its getting called when the list name is clicked. Below is the relevant code for the same:
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static class AAFlows extends PreferenceFragment implements Preference.OnPreferenceClickListener {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
addPreferencesFromResource(R.xml.pref_flows);
setHasOptionsMenu(true);
// Bind the summaries of EditText/List/Dialog/Ringtone preferences
// to their values. When their values change, their summaries are
// updated to reflect the new value, per the Android Design
// guidelines.
ListPreference flows = (ListPreference) findPreference(getString(R.string.pref_key_flows));
flows.setOnPreferenceClickListener(this);
}
@Override
public boolean onPreferenceClick(Preference preference) {
ListPreference flows1 = (ListPreference) findPreference(getString(R.string.pref_key_flows));
Log.d("TestingOutside2",flows1.getValue());
return true;
}
}
How can I trigger an action when any of the values in the list is selected?
