I am using a XML parser and as result I get a ArrayList
with my objects:
ArrayList <Datapoint> itemsList = parseXML();
One Datapoint object consists of the following Strings:
name: a
stateBased: b
mainNumber: c
dptID: d
groupadress: e
priority: f
I was already able to display all the objects with this code:
for(int i=0;i<itemsList.size();i++)
{
item = itemsList.get(i);
parsedData = parsedData + "----->\n";
String name = parsedData + "Name: " + item.getName() + "\n";
String stateBased = parsedData + "stateBased: " + item.getStateBased() + "\n";
String mainNumber = parsedData + "mainNumber: " + item.getMainNumber() + "\n";
String dptID = parsedData + "dptID: "+ item.getDptID() + "\n";
String groupadress = parsedData + "Groupadress: "+ item.getGroupadress() + "\n";
String priority = parsedData + "priority: "+ item.getPriority() + "\n";
}
It would be great to have for example 5 string arrays each as a object from my ArrayList including the strings shown above.
String [] Object 1 = {name = a, stateBased = b, dptID =c, ..}
String [] Object 2 = {name = d, stateBased = e, dptID =f, ..}
String [] Object 3 = {name = g, stateBased = h, dptID =i, ..}
But how can i programmatically create a StringArray with each iteration? Something like this:
for(int i=0;i<itemsList.size();i++)
{
item = itemsList.get(i);
String [] [i] = new String [itemsList.size()];
//insert strings to the array
}
How can I realize this or what would be an alternative?
Thanks!