You will be better off with the ListView and Adapter parameter, you will need to create a custom ArrayAdapter to populate the ListView from these objects the way you want.
The advantage of this technique is that you get a Rec Views engine that will process the Views inside you ListView to spend less memory.
In short you will need:
1. Create an object that represents your data for one row.
2. Create an ArrayList for these objects.
3. Create a layout containing a ListView, or add a ListView to the main layout using code.
4. Create a single line layout.
5. Create a ViewHolder that will represent the visual aspect of your data row from the Views point.
6. Create a custom ArrayAdapter that will fill the lines according to your needs.
7. Finally, assign this ArrayAdapter your ListView in onCreate .
You can get an idea of ββhow to implement this by reading this blog post, I wrote:
Create a Custom ArrayAdapter
source share