I
I
Ivan Balaksha2014-12-01 18:25:18
Android
Ivan Balaksha, 2014-12-01 18:25:18

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

3 answer(s)
A
Andrey Golubkov, 2014-12-01
@tagantroy

See for yourself whichever is more comfortable for you.
I do and so and so, "on mood."
But I prefer OnClickListener more.

M
Max, 2014-12-02
@mbelskiy

Third option: private final OnClickListener class member, inside which switch-case.

A
Andrey Myvrenik, 2014-12-02
@gim0

In my opinion, switch-case is a clumsy way of handling events. Use onClickListener.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question