I have a for loop in which i test for the size of a list.
for(int i = 0; i< thumbLinks.size(); i++) {
Log.e("URL" + i, thumbLinks.get(i));
url0 = thumbLinks.get(i);
url1 = thumbLinks.get(i);
//Fix index out of bounds exception
url2 = thumbLinks.get(i);
}
When i is added each time as you can see i am asking for i 3 times to get 3 urls. Since i am unsure about how many URL’s i will have. I use i to increase.
The correct output i want is for
url0 = thumbLinks.get(i);// which is support to be equivalent to 1
url1 = thunkLinks.get(i);//which is suppose to be equivalent to 2
and so on..
But my code doesnt do this…
It just adds 1 each time to each url.
How can i fix this
?
EDIT: Okay, so it sounds like you really only want to deal with up to three URLs. So you want something like:
EDIT: I’m assuming you want to deal with the URLs in batches of three for some reason. If that’s not the case, it’s not clear what you are trying to do.
Your code isn’t clear – you’re not incrementing
ibetween calls tothumbLinks.get(i)– but I suspect you want something like:Or: