Get a child view of TableRow
To get child View of a TableRow, you can use following method,
tablerow.getChildAt(columnno);
//here columnno is 0 based index
eg:
At times we store string data in tag of TableRow View using setTag(“tagdata”) method, We can get that stored data using following code
If View is placed in 5th column
for (int i = tl.getChildCount(); --i >= 1;) {
//here --i>==1 is used to exclude table header
TableRow tr=(TableRow)tlServiceManual.getChildAt(i);
View chkView=(View)tr.getChildAt(4);
// here column is 4, since 0 based index
if(chkView.getTag()!=null{
//do something
}
}
Hope it helps somebody..
(Y)
You may be also interested
- ScrollView auto scroll to show content in app screen
- Create Rounded Shapes to apply Button background dynamically
- Show soft keyboard for EditText when Fragment starts
One thought on “Get a child view of TableRow in a TableLayout”
how can i get the number of rows in a dynamically added table and get it displayed in a textview??