I’ve got a simple 3 item array that I’ve shuffled and output into a single texview. What I’d like to do is output each number into it’s own textview. I’ve got this code, but at chop[0]; and chop[2]; I’m getting the error Syntax error on token ";", invalid AssignmentOperator. Maybe I’m doing the chopping of the array totally wrong? Here’s the code:
String[] numbArray = { "1", "2", "3" };
List<String> aList = new ArrayList<String>();
for (String s: numbArray)
aList.add(s);
Collections.shuffle(aList);
for (String showNum : aList) {
String[] chop = showNum.split(" ");
chop[0];
chop[1];
chop[2];
textview1.setText(chop[0]);
textview2.setText(chop[1]);
textview3.setText(chop[2]);
}
I think you want this:
The lines:
are incorrect because they do nothing. The compiler expect that you assign some value to those references.