I have made a string array with some names, now I want to change the order of the values and then use a for-loop. my only problem is that I don't know how to change the array values order. here is my code :
This is the array:
people = new ArrayList<>();
people.add("Sam");
people.add("John");
people.add("Kim");
people.add("Edison");
"text" is my textview and "people" is my array with 4 values. I have tried this:
int rando = (int)(Math.random() *4);
for (i=0; i< people.size(); i++) {
text.append(people.get(rando));
}
but it only prints one of the values four times. Like this:
KimKimKimKim
Aucun commentaire:
Enregistrer un commentaire