I wrote some code to load a lot of pictures step by step into imageviews. But if i run the code i get Index Out of Bound Exception: Invalid index 16, size is 15
Here is my Code
int steps = 5;
int tmp = 0;
for (int j = 0; j < imageUrl.size(); j++) {
if (imageUrl.size() < steps) {
for (int i = 0; i < imageUrl.size(); i++) {
buildPicture(imageUrl.get(tmp));
imageUrl.remove(tmp);
tmp++;
}
} else if (imageUrl.size() >= steps) {
for (int i = 0; i < steps; i++) {
buildPicture(imageUrl.get(tmp));
imageUrl.remove(tmp);
tmp++;
}
}
}
Please, can you help me fixed my code?