Stay organized with collections
Save and categorize content based on your preferences.
OnClickListener
interface OnClickListener
Interface definition for a callback to be invoked when a view is clicked.
Summary
Public methods |
abstract Unit |
Called when a view has been clicked.
|
Public methods
onClick
abstract fun onClick(v: View!): Unit
Called when a view has been clicked.
Parameters |
v |
View!: The view that was clicked. |
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,["# View.OnClickListener\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels)\n\nOnClickListener\n===============\n\n*** ** * ** ***\n\nKotlin \\|[Java](/reference/android/view/View.OnClickListener \"View this page in Java\") \n\n```\ninterface OnClickListener\n```\n\n|----------------------------------------|\n| [android.view.View.OnClickListener](#) |\n\n|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known Direct Subclasses [CharacterPickerDialog](../text/method/CharacterPickerDialog.html#), [KeyboardView](../inputmethodservice/KeyboardView.html#), [QuickContactBadge](../widget/QuickContactBadge.html#) |---------------------------------------------------------------------|------------------------------------------------------------------------------------------| | [CharacterPickerDialog](../text/method/CharacterPickerDialog.html#) | Dialog for choosing accented characters related to a base character. | | [KeyboardView](../inputmethodservice/KeyboardView.html#) | A view that renders a virtual [Keyboard](../inputmethodservice/Keyboard.html#). | | [QuickContactBadge](../widget/QuickContactBadge.html#) | Widget used to show an image with the standard QuickContact badge and on-click behavior. | |\n\nInterface definition for a callback to be invoked when a view is clicked.\n\nSummary\n-------\n\n| Public methods ||\n|---------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------|\n| abstract [Unit](https://kotlinlang.org/api/latest/jvm/stdlib/kotlin/-unit/index.html) | [onClick](#onClick(android.view.View))`(`v:` `[View](/reference/kotlin/android/view/View)!`)` Called when a view has been clicked. |\n\nPublic methods\n--------------\n\n### onClick\n\nAdded in [API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element.html#ApiLevels) \n\n```\nabstract fun onClick(v: View!): Unit\n```\n\nCalled when a view has been clicked.\n\n| Parameters ||\n|-----|--------------------------------------------------------------------------|\n| `v` | [View](/reference/kotlin/android/view/View)!: The view that was clicked. |"]]