I have a table that is as simple as this one .
I need the end user to be able to click each cell of the table and do something in each cell.
But it looks like the table layout supports a row based on the click event, no cell based on the click event. How to get rid of this?
You need to handle click events using android:clickable="true"and android:onClick="clickHandlerCell"in the XML format definition file, in my case in LinearLayout.
android:clickable="true"
android:onClick="clickHandlerCell"
, , view.setTag(uniqueID) . clickHandlerCell view.getTag(), .
view.setTag(uniqueID)
view.getTag()
, , Table Row:
TableLayout contact_table = (TableLayout)findViewById(R.id.contact_table); final View row=contact_table.getChildAt(i); row.setOnClickListener(new OnClickListener(){ @Override public void onClick(View v){ // TODO Auto-generated method stub row_id=contact_table.indexOfChild(row); } });