I looked through tutorials for TableLayouts and other similar things, but it all seems programmed as a static number of rows with a textview. I am wondering if it is possible to create a simple data table with three columns and a variable rowset. I can add / remove elements from Java code.
Basically, there is something like this:
DATA DATA DATA row1 data data row2 data data
and populate this table with data from an array of objects in the Java activity class. Later, if I want to add another object, it will simply create another line.
For example, if I have this in java:
Class data{ public data(String d1, String d2, String d3){ data1=d1; data2=d2; data3=d3; } }
and this is in the activity class:
Class activity{ data info[] = { new data("row1", "row1", "row1"), new data("row2","row2","row2"), new data("row3","row3","row3")}; } }
And I will use the for loop to add this data to the table in the action, no matter how many rows I need so that everything is in order. If I add a new row4 object, it will just add another row and end with:
row1 row1 row1 row2 row2 row2 row3 row3 row3
Hope I wasn’t too vague ... Thanks in advance guys! :)