Android Basics – Learn how to handle Clicks in a ListActivity using onListItemClick

By now you should be familiar with a ListActivity and how to use this to display items.

So what happen’s when a user clicks on an item. How can you handle that ?

The good news is that you don’t need to use an EventListener. You can simply override onListItemClick method.

public void onListItemClick(ListView listView, View itemView, int position, long id){
    //Implement your Logic
    //Here id param is id of the item clicked. It can also be the DB unique id

Source code is available here