‫Welcome back.
‫In this video, we'll handle the click events on the list view items.
‫So whenever the user clicks on any of the items of this list of view, it will display a toast message
‫or do a specific action.
‫I'll go down here under set adapter.
‫I'll use list view dot set on item click Listener New adapter view dot on item Click listener and the
‫on item.
‫Click method is a callback method that is commonly used with list, view, grid view and other adapter
‫view widgets to respond to user clicks on individual items within the list or grid.
‫Let's break down the parameters of this method.
‫The adapter View.
‫This parameter refers to the adapter view in which the click event occurred.
‫It can represent a list, view, grid, view or other adapter view widgets.
‫The view this parameter represents.
‫It's the specific view that was clicked within the adapter view.
‫It's the view representing the item that the user interacted with the position, which is an INT.
‫And this parameter indicates the position of the clicked item within the adapter views list of items.
‫The position is zero based, so the first item is at position zero, the second at position one and
‫so on.
‫Lung ID and this is the fourth parameter.
‫This parameter holds the row ID of the clicked item.
‫In most cases, this value is the same as the value of the parameter position.
‫However, it can be useful for scenarios involving databases or adapters with unique identifiers for
‫items.
‫For that, I'll create a toast message here.
‫And I'll display planet name.
‫And I'll use adapter dot get item at position position dot get planet name.
‫So in this case I'm using the adapter and getting the item at position, position and get planet name.
‫Let's run.
‫If we click on Earth, planet name, Earth, Mars, Planet Name, Mars and Cell one.
‫So congratulations guys.
‫We succeeded in handling the click events on custom list of use.