Content and code samples on this page are subject to the licenses described in the Content License. Java and OpenJDK are trademarks or registered trademarks of Oracle and/or its affiliates.
Last updated 2025-02-10 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-02-10 UTC."],[],[],null,["# Preference.OnPreferenceClickListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \nDeprecated in [API level 29](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnPreferenceClickListener\n=========================\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/preference/Preference.OnPreferenceClickListener \"View this page in Java\") \n\n```\ninterface OnPreferenceClickListener\n```\n\n|--------------------------------------------------------------|\n| [android.preference.Preference.OnPreferenceClickListener](#) |\n\n*** ** * ** ***\n\n| **This interface was deprecated in API level 29.**\n|\n| Use the [AndroidX](https://developer.android.com/jetpack/androidx.html) [Preference Library](https://developer.android.com/reference/androidx/preference/package-summary.html) for consistent behavior across all devices. For more information on using the AndroidX Preference Library see [Settings](https://developer.android.com/guide/topics/ui/settings.html).\n\nInterface definition for a callback to be invoked when a [Preference](/reference/kotlin/android/preference/Preference) is clicked.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------------|-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | [onPreferenceClick](#onPreferenceClick(android.preference.Preference))`(`preference:` `[Preference](/reference/kotlin/android/preference/Preference)!`)` Called when a Preference has been clicked. |\n\nPublic methods\n--------------\n\n### onPreferenceClick\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onPreferenceClick(preference: Preference!): Boolean\n```\n\n**Deprecated:** *Deprecated in Java.*\n\nCalled when a Preference has been clicked.\n\n| Parameters ||\n|--------------|--------------------------------------------------------------------------------------------------|\n| `preference` | [Preference](/reference/kotlin/android/preference/Preference)!: The Preference that was clicked. |\n\n| Return ||\n|------------------------------------------------------------------------------------|--------------------------------|\n| [Boolean](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-boolean/index.html) | True if the click was handled. |"]]