Is it possible to bind a TableLayout with a ArrayAdapter?

Manish Khot picture Manish Khot · Feb 18, 2011 · Viewed 16.2k times · Source

Is it possible to bind a TableLayout with a ArrayAdapter?

Answer

Romain Guy picture Romain Guy · Feb 18, 2011

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));
}