Reputation: 1937
I am having this error:
@Override
public void paint(Canvas canvas) {
}
The method paint(Canvas)
of type MainActivity must override or implement a supertype method.
The error disappears only if I remove the @Override
before the method.
I have already set in project properties java compiler on level 1.6
Can you help me?
Upvotes: 2
Views: 1068
Reputation: 83
if indeed the method that you want to override exists in the parent class then make sure you are compiling with at least java 1.6
So left click on your project -> properties -> Java Compiler -> Select at least java 1.6 then clean the project and rebuild.
Upvotes: 0
Reputation: 178431
It seems you are trying to override a method that doesn't "exist" in MainActivity
's superclass.
Some possible reasons (and solutions):
extends ...
to the class you think it (MainActivity
) inherits from.paint()
- if this is the case - just change the method name@Override
annotation if you are after overloading.Upvotes: 1
Reputation: 14237
If you are extending an Activity
you can't override the paint method.
Paint is not an Activity
method. You can only override existent methods from the class you are extending.
Also I never used Paint. Did you want to override the onDraw(Canvas)
from the View
?
Upvotes: 3