1. Introducing Channels - a new way to chat with other Android users!
    Dismiss Notice

TableLayout Onclick


Last Updated:

  1. ramesh_bh

    ramesh_bh Member This Topic's Starter

    Joined:
    Sep 16, 2010
    Messages:
    17
    Likes Received:
    1
    Hi,

    I have a table and rows in my application,i want to add onclick for each row.
    i have done some thing like this :
    TableLayout table = new TableLayout(this);
    for (int i = 0; i < list.size(); i++) {
    TextView t = new TextView(this);
    TextView t1 = new TextView(this);
    TextView t2 = new TextView(this);

    HashMap map = (HashMap) list.get(i);
    Set set = map.keySet();
    int j = 0;
    for (Iterator iterator = set.iterator(); iterator.hasNext();) {
    String object = (String) iterator.next();
    String value = (String) map.get(object);
    tr = new TableRow(this);
    switch (j) {
    case 0:
    t.setText(value);
    break;
    case 1:
    t1.setText(value);
    break;
    case 2:
    t2.setText(value);
    break;

    j++;
    }
    tr.addView(t, new TableRow.LayoutParams(1));
    tr.addView(t1, new TableRow.LayoutParams(2));
    tr.addView(t2, new TableRow.LayoutParams(3));

    table.addView(tr,new TableLayout.LayoutParams());

    But i got all the results when i click any row. i want to capture particular row and its corresponding values when i click.

    Please help

    Ramesh
     

    Advertisement

Share This Page

Loading...