14

Is it possible to bind a TableLayout with a ArrayAdapter?

Ricardo Altamirano
  • 14,650
  • 21
  • 72
  • 105
Manish Khot
  • 3,027
  • 2
  • 29
  • 37

1 Answers1

28

There is no such API in the framework. You can do it manually by querying the adapter yourself. Something like this:

int count = adapter.getCount();
for (int i = 0; i < count; i++) {
    tableLayout.addView(createTableRow(adapter.getItem(i)); // or tableLayout.addView(adapter.getView(i, null, tableLayout));
}
Romain Guy
  • 97,993
  • 18
  • 219
  • 200
  • 3
    Thanks for your response. How do i ensure that the views are getting recycled as that of the convert View? – Manish Khot Feb 18 '11 at 09:43
  • 11
    You can't unless you are willing to reimplement a view recycler like ListView's, and trust me, it's a lot of work you don't want to do :p – Romain Guy Feb 18 '11 at 10:05