Ok so somewhere in my getposition method for webview I am messing up and getting an array out of bounds exception. Basically I want my app to cycle through the array list when its done. However if the 'reloadTime' on the item in the array list has not passed, to skip to the next item. if it cycles through all items in the array list and none are passed it displays a blank screen. Everythign works except my array still goes out of bounds somewhere.
private int getPosition(int binary){
Log.e("tree","getPosition run");
//if positions is to the right
if (binary==1){
//make sure count doesnt go over array size for out of index
int placeHolder;
if (position==urls.size()-1) placeHolder = position+1%(urls.size()-1);
else placeHolder = position+1;
while (System.currentTimeMillis()<urls.get(placeHolder).getReloadTime()) {
placeHolder=placeHolder+1%(urls.size()-1);
if (placeHolder==position) {
displayNone();
break;
}
} if (System.currentTimeMillis()>urls.get(placeHolder).getReloadTime()) {
position=placeHolder;
return position;
}
}else {
int placeHolder;
if (position>0) placeHolder = position-1%(urls.size()-1);
else placeHolder=urls.size()-1;
while (System.currentTimeMillis()<urls.get(placeHolder).getReloadTime()) {
placeHolder=placeHolder-1%(urls.size()-1);
if (placeHolder==position) {
displayNone();
break;
}
} if (System.currentTimeMillis()>urls.get(placeHolder).getReloadTime()) {
position=placeHolder;
return position;
}
}
return position;
}