Stay organized with collections
Save and categorize content based on your preferences.
AdapterView.OnItemClickListener
public
static
interface
AdapterView.OnItemClickListener
android.widget.AdapterView.OnItemClickListener
|
Known indirect subclasses
|
Interface definition for a callback to be invoked when an item in this
AdapterView has been clicked.
Summary
Public methods |
abstract
void
|
onItemClick(AdapterView<?> parent, View view, int position, long id)
Callback method to be invoked when an item in this AdapterView has
been clicked.
|
Public methods
public abstract void onItemClick (AdapterView<?> parent,
View view,
int position,
long id)
Callback method to be invoked when an item in this AdapterView has
been clicked.
Implementers can call getItemAtPosition(position) if they need
to access the data associated with the selected item.
Parameters |
parent |
AdapterView : The AdapterView where the click happened. |
view |
View : The view within the AdapterView that was clicked (this
will be a view provided by the adapter) |
position |
int : The position of the view in the adapter. |
id |
long : The row id of the item 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,["# AdapterView.OnItemClickListener\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \nSummary: [Methods](#pubmethods) \n\nAdapterView.OnItemClickListener\n===============================\n\n*** ** * ** ***\n\n[Kotlin](/reference/kotlin/android/widget/AdapterView.OnItemClickListener \"View this page in Kotlin\") \\|Java\n\n\n`\npublic\nstatic\n\n\ninterface\nAdapterView.OnItemClickListener\n`\n\n\n`\n\n\n`\n\n|------------------------------------------------|\n| android.widget.AdapterView.OnItemClickListener |\n\n|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Known indirect subclasses [CharacterPickerDialog](/reference/android/text/method/CharacterPickerDialog), [PreferenceScreen](/reference/android/preference/PreferenceScreen) |-------------------------------------------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| | [CharacterPickerDialog](/reference/android/text/method/CharacterPickerDialog) | Dialog for choosing accented characters related to a base character. | | [PreferenceScreen](/reference/android/preference/PreferenceScreen) | *This class was deprecated in API level 29. Use the [AndroidX](/jetpack/androidx) [Preference Library](/reference/androidx/preference/package-summary) for consistent behavior across all devices. For more information on using the AndroidX Preference Library see [Settings](/guide/topics/ui/settings).* | |\n\n\u003cbr /\u003e\n\n*** ** * ** ***\n\nInterface definition for a callback to be invoked when an item in this\nAdapterView has been clicked.\n\nSummary\n-------\n\n| ### Public methods ||\n|------------------|--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| ` abstract void` | ` `[onItemClick](/reference/android/widget/AdapterView.OnItemClickListener#onItemClick(android.widget.AdapterView\u003c?\u003e,%20android.view.View,%20int,%20long))`(`[AdapterView](/reference/android/widget/AdapterView)`\u003c?\u003e parent, `[View](/reference/android/view/View)` view, int position, long id) ` Callback method to be invoked when an item in this AdapterView has been clicked. |\n\nPublic methods\n--------------\n\n### onItemClick\n\nAdded in [API level 1](/guide/topics/manifest/uses-sdk-element#ApiLevels) \n\n```\npublic abstract void onItemClick (AdapterView\u003c?\u003e parent, \n View view, \n int position, \n long id)\n```\n\nCallback method to be invoked when an item in this AdapterView has\nbeen clicked.\n\n\nImplementers can call getItemAtPosition(position) if they need\nto access the data associated with the selected item.\n\n\u003cbr /\u003e\n\n| Parameters ||\n|------------|---------------------------------------------------------------------------------------------------------------|\n| `parent` | `AdapterView`: The AdapterView where the click happened. \u003cbr /\u003e |\n| `view` | `View`: The view within the AdapterView that was clicked (this will be a view provided by the adapter) \u003cbr /\u003e |\n| `position` | `int`: The position of the view in the adapter. \u003cbr /\u003e |\n| `id` | `long`: The row id of the item that was clicked. \u003cbr /\u003e |"]]