Hi.
I have some dynamic buttons that are being generated inside a for loop.
for (int i = 0; i < 5 ; i++) {
> Button aUIXButton = new Button (SecondPage.this);
aUIXButton.setClickable(true);
aUIXButton.setText("X");
> aUIXButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View arg0) {
aUIXButton.setText("Y");
}});
}
This is not working. It says
"Cannot refer to a non-final variable aUIXButton inside an inner class
defined in a different method"
& wants to change the modifier of aUIXButton to final & I don't want to do
that.
Does anyone know how can I fix this?
Thank you,
--
You received this message because you are subscribed to the Google
Groups "Android Developers" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/android-developers?hl=en