In android, through xml parsing i have xml file values in tableview now which are stored in an array.
Now my question is i want to apply textclick on that values.
For example: if values are
Lotus
Lily
Rose
Jasmine
and i want to click on Rose
then how can i take particular array value from the table and apply intent on it???
the for loop that i have applied in parsing from where im getting array values:
for (int i = 0; i < data.getName().size(); i++) {
TableRow tr = new TableRow(this);
//tr.setId(100+i);
tr.setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
// Create a TextView to house the name of the province
name[i]= new TextView(this);
name[i].setId(200+i);
name[i].setText(data.getName().get(i));
name[i].setTextColor(Color.WHITE);
name[i].setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
tr.addView(name[i]);
value[i] = new TextView(this);
value[i].setId(i);
value[i].setText(data.getValue().get(i));
value[i].setTextColor(Color.WHITE);
value[i].setLayoutParams(new LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
tr.addView(value[i]);
t1.addView(tr, new TableLayout.LayoutParams(
LayoutParams.FILL_PARENT,
LayoutParams.WRAP_CONTENT));
}
}
Well, if it’s TableView, than it has some rows in it. Depending on implementation, you may wrap your textView into, for instance, linear layout and add click listener to it. For more information please be more specific regarding the issue.