Reputation: 2661
If I use multiple ids with same @Click event method like
@ViewById Button choice1;
@ViewById Button choice2;
@Click({R.id.choice1,R.id.choice2})
void choice(){
//String text = text of the clicked button
}
How will I get the text of the button that is being clicked?
Upvotes: 0
Views: 54
Reputation: 1561
As wrote on the wiki you can add a View
parameter in your method signature, like this :
@Click({R.id.choice1, R.id.choice2})
void choice(View clickedView) {
[...]
}
Also you don't have to annotate your buttons with ViewById
in order to use Click
(unless you really need a reference to these instances, of course)
Upvotes: 1