Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why it is not possible to create a class that extends OnTouchListener

Tags:

java

oop

android

Android SDK has an interface in TouchEvent. (android.view.View.OnTouchListener) I don't know why the following line fails. (and Eclipse notices error at OnTouchListener)

public class TouchHandler extends OnTouchListener{

And it works if change to:

public interface TouchHandler extends OnTouchListener{

It means that I cannot create a class that extends OnTouchListener. Can somebody explain why?

thanks :)

like image 862
hqt Avatar asked Nov 22 '25 23:11

hqt


1 Answers

Instead of

public class TouchHandler extends OnTouchListener{

use implements

public class TouchHandler implements OnTouchListener{
like image 200
Paul Nikonowicz Avatar answered Nov 25 '25 11:11

Paul Nikonowicz



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!