I\'m quite new to Android Development and just came across Preferences.
I found PreferenceScreen and wanted to create a login functionality with it. The only pr
If you'd like to catch a user click on one of the Preferences items and your app is using PreferenceFragmentCompat, then you can do this:
...
...
Java:
@Override
onPreferenceTreeClick(Preference preference) {
if (preference.getKey().equals(getContext().getString(R.string.pref_key_clickable_item))) {
// user clicked the item
// return "true" to indicate you handled the click
return true;
}
return false;
}
Kotlin:
override fun onPreferenceTreeClick(preference: Preference): Boolean {
if (preference.key == context?.getString(R.string.pref_key_clickable_ite)) {
// user clicked the item
// return "true" to indicate you handled the click
return true
}
return false
}