There appears to be a number of similar questions been asked here but they do not seem to answer or solve my issue.
I have created an ArrayList and filled with random numbers,, these random numbers need to be displayed in Textviews in a LinearLayout.
Random rand = new Random();
List<Integer> list1 = new ArrayList<Integer>();
List<Integer> list2 = new ArrayList<Integer>();
for (int i=1; i<2; i++) {
for (int mbs=1; mbs <= 4; mbs++) {
int randNum1 = rand.nextInt(37 - 1) + 1;
list1.add(randNum1);
Collections.shuffle(list1);
for (int j = 1; j<=2; j++){
int randNum2 = rand.nextInt(16 - 1)+1;
list2.add(randNum2);
Collections.shuffle(list2);
}
}
}
}
I used ( this is just one of the TextViews )
TextView tv1l1 = findViewById(R.id.tv1l1);
Then wanted to put the random number from list1 or list2 into this using
tv1l1.setText(list1(0));
I get error message saying can not resolve list1.
I would have thought that what I am trying to do would be easy but for some reason I can not get it, any help ?