I've looked around at tutorials for TableLayouts and other such things, but all of it seems to be programmed as a static number of rows with textview's. I'm wondering if it would be possible to create a simple table of data, with 3 columns and a variable set of rows I can add/remove items from in the Java code.
Basically, have something like this:
DATA DATA DATA
row1 data data
row2 data data
and fill this table with data from an object array in the activity's Java class. Later, if I want to add another object, it will just create another row.
For instance, if I have this in java:
Class data{
public data(String d1, String d2, String d3){
data1=d1;
data2=d2;
data3=d3;
}
}
and this 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 a for loop to add this data into the table in the activity, regardless of how many rows I need for all of it to be fit. If I add a new object of row4, it will just add another row, and end with:
row1 row1 row1
row2 row2 row2
row3 row3 row3
I hope I haven't been too vague... Thanks in advance, fellas! :)