8

I would like to create a table which is filled by data from DB. I know that it is possible to create a dynamic table using TableLayout but I'm not sure that it's the best solution im my case.
Here is an example of what I want to create(the first table on the page).

Brian Tompsett - 汤莱恩
  • 5,753
  • 72
  • 57
  • 129
Arsen Gyulgazyan
  • 123
  • 1
  • 1
  • 4

1 Answers1

14

I'll give you my inputs on this.

If your data is limited and you are sure to display all of it in a single screen in a presentable manner, then yes, a TableLayout will suffice.

However, in a real world, flexibility counts so you should always consider the possibility that your data may expand in the future. Keeping that in mind, you should use a ListView or a RecyclerView in this case. Define a base layout for each row of your list or recycler view and then connect the data from your database to this view using a suitable adapter.

For starters: https://developer.android.com/training/material/lists-cards.html

androholic
  • 3,633
  • 3
  • 22
  • 23