I have a Table Layout, that I am dynamically adding rows to.
In my code, I created an array of TableRows that is of size = to the number of rows in my Cursor (database results).
So as I walk through the cursor while loop, I create a new Table Row, whose index is my position in the cursor.
The table displays fine but I am trying to add a Listener to each row, but I cannot figure out how to find out which row the user clicked.
Any Ideas? The problem is that I cannot use the RowCount value because at the time that they click on the row, RowCount is no longer what it was when the row was created, since the table has been created, rowCount now has a value of the total # of Rows.
Is there a getSelectedRow or something similar that I can use on an onClickListener for the TableLayout?
In my code, I created an array of TableRows that is of size = to the number of rows in my Cursor (database results).
So as I walk through the cursor while loop, I create a new Table Row, whose index is my position in the cursor.
Code:
trArray[rowCount] = new TableRow(this);
//add data to the row
tableLayout.addView(trArray[rowCount])
The table displays fine but I am trying to add a Listener to each row, but I cannot figure out how to find out which row the user clicked.
Any Ideas? The problem is that I cannot use the RowCount value because at the time that they click on the row, RowCount is no longer what it was when the row was created, since the table has been created, rowCount now has a value of the total # of Rows.
Is there a getSelectedRow or something similar that I can use on an onClickListener for the TableLayout?