Answer the question
In order to leave comments, you need to log in
What is better to use for handling button clicks: anonymous classes or switch-case?
What is better to use? Assign OnClickListener through anonymous classes or in xml + one method in code with switch-case on R.id ?
Answer the question
In order to leave comments, you need to log in
See for yourself whichever is more comfortable for you.
I do and so and so, "on mood."
But I prefer OnClickListener more.
Third option: private final OnClickListener class member, inside which switch-case.
In my opinion, switch-case is a clumsy way of handling events. Use onClickListener.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question