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 🙂
You should use TouchHandler implements OnTouchListener
extending an interface is only possible when defining an interface (ie:extending a contract)
implementing an interface is the java way to have a class provide code for methods of an interface. (ie: defining how the contract is handled)