Reputation: 161
I wanted to know if there are any listeners in Android that allows you to toggle the common boolean-based attribute of a bunch/list of views (a set of TextViews etc. and attributes like say visibility or focusable), if one of them is changed. For example, if I have Views A, B and C and I only need one of them to be visible at a time based on one of them clicked. I can do this switch case below provided I've created OnClickListeners for each items A, B and C which works but this is long and tedious. Is there a better implementation than the one below?:
switch(v.getId()){
Case R.id.A:
//set A visible
//set B invisible
//set C invisible
break;
Case R.id.B:
//set A invisible
//set B visible
//set C invisible
break;
Case R.id.C:
//set A invisible
//set B invisible
//set C visible
break;
default:
//do something else
}
Upvotes: 0
Views: 321
Reputation: 656
I think what you want is answered here. This is what I used when I needed to listen for a Boolean value that has been changed https://stackoverflow.com/a/7157281/2258389
Upvotes: 1