Search code examples
androidandroid-adapterandroid-tablelayout

Is it possible to bind a TableLayout with a ArrayAdapter?


Is it possible to bind a TableLayout with a ArrayAdapter?


Solution

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