Reputation: 39
I am trying to create a subclass that will extend and override the onTouchEvent method. However, I am unable to do so as I am not entirely sure how to go about it.
Can I place the override in a public class that extends Activity, or would it have to be a subclass that extends View? When I try to extend View, I get the error "There is no default construction available in 'android.view.View'.
I have never tried to subclass or override anything before, as I have never tried developing in Java before. I have to make a minor change to a code I have, where the developer is no longer available - so, any help would be appreciated.
Upvotes: 2
Views: 136
Reputation: 39447
Can I place the override in a public class that extends Activity, or would it have to be a subclass that extends View?
Try sub-classing View
.
"There is no default constructor available in 'android.view.View'"
Just provide default implementations of all constructors from View
(calling the respective super constructors with the same signatures).
If you're using Eclipse, it can do it for you.
Upvotes: 1