Hi Mark,

Thank you for details.. In the interest of others these are the code
level details we have done..

1. We have One main xml with tablelayout
2. Another  layout xml with table row specification

We every time we need to add a new row to the table, we inflate the
row xml and and find the id's, add the respective listeners.. detatch
the row from the inflated overall view and add to first views table.
Code for this is below.

addRow()
{
TableLayout tl = (TableLayout) getActivity().findViewById(R.id.table);

        LayoutInflater inflater = (LayoutInflater) (getActivity
()).getSystemService(
                Context.LAYOUT_INFLATER_SERVICE);
        LinearLayout v = (LinearLayout) inflater.inflate
(R.layout.dial_relation_infate_row,
                                                         null,
                                                         false);

        TableRow lableRow = (TableRow) v.findViewById(R.id.labelRow);
        TextView lableField = (TextView) v.findViewById(R.id.labelField);
        v.removeView(lableRow);
        tl.addView(lableRow);
        labelRows.add(lableRow);

        TableRow fieldRow = (TableRow) v.findViewById(R.id.fieldRow);
        Button fieldButton = (Button) v.findViewById(R.id.fieldButton);
        fieldButton.setTag(dataRows.size());
        fieldButton.setOnClickListener(this);

        v.removeView(fieldRow);
        tl.addView(fieldRow);
}

Android power is in this approach to writ powerful ui with ease.

Mark, one observation regarding the id's that different rows coudl
have the same id and one could get row specific component could be
found by asking the view to find the component. This has made us not
to change the id's too.

Regards,
Raja Nagendra Kumar,
C.T.O
www.tejasoft.com

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to