how to handle the click event on each cell in a table layout


I have a table layout which is as simple as this one.

What I need is to allowed end user to click each cell of the table, and do something on each cell.

But, it seems android table layout only support row based on click event, no cell based on click event. How to get rid of this?

You need to handle the click events using android:clickable="true" and android:onClick="clickHandlerCell" in your XML layout definition file, in my case in a LinearLayout.

To identify wich cell was clicked you could tag the view of each cell using view.setTag(uniqueID) when you create it. In clickHandlerCell function use view.getTag() to get the identity of your cell.