looping through List android
for (E element : list) {
. . .
}
KOTLIN:
val numbers = listOf("one", "two", "three", "four")
for (item in numbers) {
println(item)
}
or
val numbers = listOf("one", "two", "three", "four")
val numbersIterator = numbers.iterator()
while (numbersIterator.hasNext()) {
println(numbersIterator.next())
}
Assuming list
is your List<String>
retuned from the function. You may loop over it like:
for (int i=0; i<list.size(); i++) {
System.out.println(list.get(i));
}
For assigning the EditText, you can just use the index, if you the number of items and it is fixed( which seem to be 5 here):
phoneNumber1.setText(list.get(0));
phoneNumber2.setText(list.get(1));
//so on ...