We have two ways to handle clicks on button-
- onClick method
- onClickListener on button
why we have two ways to handle onClick?
when we should use method and when we should use listener?
We have two ways to handle clicks on button-
why we have two ways to handle onClick?
when we should use method and when we should use listener?
Both are practically the same.
only difference is onclick is set through xml and onClickListner is set in the javacode.
There aren’t any particular cases where you need to choose either of them.
Both are same on performance.
I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.
On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.