Fancy dynamic list in Android: TableLayout vs ListView?

Using ListView and ArrayAdapter you can do more complicated layouts than just a TextView. You could specify a LinearLayout with 2 TextViews and 2 Buttons for each row in the List here's a similar question stackoverflow.com/questions/1709166/andr....

Using ListView and ArrayAdapter you can do more complicated layouts than just a TextView. You could specify a LinearLayout with 2 TextViews and 2 Buttons for each row in the List. Here's a similar question stackoverflow.com/questions/1709166/andr....

Because of your answer I reconsidered ListView and I've managed to make it work as required, thanks. – Ralkie Jun 17 '10 at 8:51 1 Still this doesn't answer the question. Is it possible to populate TableLayout with ArrayAdapter – Nayn Jun 25 '10 at 17:02 @Nayn - Of course it's possible.Is it worth the effort, rather than just using the right tool for the job (ListView)?

Probably not, so James' answer satisfies the question. – kiswa Jul 15 '10 at 14:54 ListView is a great way to implement a list of items that use an Adapter, but it's not always possible to use it (oh how much I wish it weren't the case). – Artem Russakovskii Jun 22 at 0:08.

IMHO it depends on the amount of your data you need to render. Build layout dinamically via inflate/addView is a quite simple task but is also more slow than using a custom adapter. With a custom adapter you can reuse the convertView parameter and then set the values more efficiently.

There is a requirement to have not-so-trivial dynamic list, each record of which consists of several columns (texts, buttons). At first obvious way to accomplish that seemed to be TableLayout. I was expecting to have layout/styling data specified in res/layout/*.

Xml and to populate it with some dataset from java code (as with ListView, for which its possible to specify TextView of item in *. Xml and bind it to some array using ArrayAdapter). But after playing for a while, all I found to be possible is fully populating TableLayout programatically.

Still, creating TableRow by TableRow and setting layout attributes directly in java code doesn't seem elegant enough. So the question is: am I at the right path? Is TableLayout really best View to accomplish that?

Maybe it's more appropriate to extend ListView or something else to meet such requirements?

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions