I have a loop that runs methods with 2 parameters. However, the indexPath parameter always equals 0 after the if statement but not before.
ArrayList<RelativeLayout> containers2 = new ArrayList<>();
containers2.add(dayNameContainer);
containers2.add(dayNumberContainer);
containers2.add(monthContainer);
containers2.add(yearContainer);
for (RelativeLayout container : containers2) {
addContainerToView(container, 0);
addContainerToView(container, 1);
addContainerToView(container, 2);
addContainerToView(container, 3);
}
Method:
public void addContainerToView(RelativeLayout container, int indexPath) {
// HERE (BEFORE THE IF STATEMENT) THE INDEXPATH PARAMETER IS CORRECT
if (sharedPreferences.getIntegerValue(container.getTag().toString()) == indexPath) {
// ISSUE HERE CONSTANTLY RECIEVING INDEX PATH AS 0 BUT ONLY AFTER THE IF STATEMENT ABOVE
positioningContainer.addDragView(container, container);
}
}
I don't really know what more to say to be honest. It seems like very strange behavior.