So when I iterate through my array list of Buttons I'm trying to set all of their onClickedListener()/onFocusChangedListener() but when it comes to modifying of altering the button in the array list it tells me it has to be final.
Code:
for(Button aBtn : menu_Buttons)
{
aBtn.setOnFocusChangeListener(new OnFocusChangeListener(){
@Override
public void onFocusChange(View arg0, boolean changed) {
Log.i("LC", "focus changed");
if(changed)
{
aBtn.setTextColor(Color.parseColor("#FFFFFF"));
Log.i("LC", "true");
}
else
{
aBtn.setTextColor(Color.parseColor("#CD6839"));
Log.i("LC", "false");
}
}
});
}
SO it asks it to be like this instead.
for(final Button aBtn : menu_Buttons)
Can someone explain this to me, I'm not working at 100% just now and I can't see why it would have to be final.
I have found other ways to iterate through the array list using other methods but this is just bugging me.