Praveen Praveen - 3 years ago 203
Android Question

Difference between OnClick() event and OnClickListener?

I'm always using

event in most of my projects. But, I read about
. Can anyone tell what's the difference between these two? And which one is best to use in Android application?.

Answer Source

I'm not sure the question is clear. View.OnClickListener is an interface, which defines the onClick(View) method. If you have a class which intends to listen for clicks, you should both implement the interface (if not already extending a class that does), and implement this method too. You have to use both; they're not somehow alternatives.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download