Android : How can I implement a 2-D array in the XML file for my java class?

on Saturday, April 18, 2015


I have a 2-D array that I want to show up on the XML file so that it can be seen on the actual activity on the phone. The contents of the array are filled by a function in the class


The code for the function looks like



public String[][] creator(String[][] newList, String[] data){
for (String obj : data){
for (char c : obj.toCharArray())
{
int i = 0;
int j = 0;
newList[i][j] = Character.toString(c);
++i;
if (i == 5){
++j;
i = 0;
}
}
}
return newList;
}


It's to take components from a string and separate all the characters in all the strings of the array and put them in a new list, as string type. I want that to show on the XML page, but I can't figure out how... I tried using TableLayout and adding it manually but that wouldn't work for data being pulled.


0 comments:

Post a Comment