this is my code
final boolean identifier = true;
if (i2 > i){
if (identifier){
v5.setOnClickListener(new View.OnClickListener(){
@Override
public void onClick(View v) {
identifier = false;
}
});
}
if (!identifier){
v5.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
identifier = true;
}
});
}
}
but this doesnt seem to be working out fine. what i want is when v5 is clicked it will run a code that will change v5 onClicklistener
Android change value of variable on click: whyidentifierisfinal?