smartmouse smartmouse - 18 days ago 5x
Android Question

How to show a list of items with 2 fields?

I'm developing my first app and I want to show a grid in which there is a list of entries. I get those entries through queries on local SQLite database so this it is a dynamic list. Every item of this list should have 2 field: a string and a value.

How to correctly do it in an activity?
I see ListView but it doesn't seem to suit my needs and I do not need clickable items.

Can you suggest a better solution?


I would still use a ListView.

They don't have to be clickable, you can customise the view to have 2 columns (or to be whatever you want) and they have great performance benefits with view recycling, etc during scrolling.

Essentially you need to return a custom view as the row - this row view will have data aligned horizontally and so you can get columns.

Here is an example.