Reputation: 37
@Override
public void onCancel() {
// TODO Auto-generated method stub
ERROR:The method onCancel() of type SoftKeyboard must override a superclass method SoftKeyboard.java /EmotePractice/src/com/emote line 691 Java Problem
Superclass?? I thought @Override was meant to catch errors made with grammar, why is it saying this?
Upvotes: 1
Views: 110
Reputation: 236122
Are you sure that the superclass you're overriding has a method called onCancel()
, with no parameters and void
return type? If the answer is no, try removing the @Override
annotation and see if it works for you.
The @Override
annotation is used for indicating that the method is overriding an identically declared method in a superclass. From the javadocs:
@Override Indicates that a method declaration is intended to override a method declaration in a superclass. If a method is annotated with this annotation type but does not override a superclass method, compilers are required to generate an error message.
Upvotes: 1
Reputation: 4054
The block of code you put it probably has some errors. For example, this SoftKeyboard might have other functions which must be overriden or perhaps defined in the first place, so this would be an error that goes away automatically once those other conditions are met. Either way, please paste more of the contextual code so that we can better isolate the issue.
BTW the @Override doesn't catch errors made with grammar but rather literally overrides the super classes predefined method.
Upvotes: 0