I have this code:
ArrayList<ArrayList<String>> row = new ArrayList<ArrayList<String>>();
ArrayList<String> column = new ArrayList<String>();
my problem is I can't add String to it. How can I add String from a TextView(in Android)?
I have this code:
ArrayList<ArrayList<String>> row = new ArrayList<ArrayList<String>>();
ArrayList<String> column = new ArrayList<String>();
my problem is I can't add String to it. How can I add String from a TextView(in Android)?
Assuming you have declared your TextView in xml (replace myTextView with your TextView's id):
TextView tv = (TextView) findViewById(R.id.myTextView);
int index = 0;//change to index in row that you want to modify
String text = tv.getText().toString();
ArrayList<String> col = row.get(index);
if (col == null) {
col = new ArrayList<String>();
col.add(text);
row.add(col);
}
else {
col.add(text);
}