I have 4 buttons and I'm wondering is this possible to dynamically assign them onClick methods. Three of these buttons should have 'lose()' method and one of them should have 'win()' method. Every turn 'win()' method will be assigned to new button. The winning button has tag 'winner' and every new turn as like above tag is assigned to new button. What's the best sollution for this?
Asked
Active
Viewed 64 times
1 Answers
1
Yes, it can be done with lambda expressions! Take a look at this link and see if it helps

Henrique Sabino
- 546
- 3
- 19
-
3It is simple OnClickListener, lambda expressions has nothing to this case. – H.Taras Apr 22 '19 at 16:16
-
Well.. yeah, but with lambda the code is cleaner and readable, so I thought it would be better in this case – Henrique Sabino Apr 22 '19 at 16:19