Take the 2-minute tour ×

i want to override the method onWindowFocusChanged, but everytimei write it elcipse gives me a error message saying @override annotation is wrong, which means that i am not overriding the method but creating a new one.

maybe i havnt included the package necessary ???

share|improve this question
If you show the code with the error, we can help you find it. Otherwise, it's just guessing. That said, if the override error is the only one you have, I'd guess your method signature is not exactly the same as the one you are overriding. –  Jorn Oct 24 '10 at 12:05
add comment

closed as not a real question by Bill the Lizard Jan 11 '13 at 1:43


3 Answers

are you using the following code:

public void onWindowFocusChanged(boolean hasFocus) {
    // your code here

The difference is there is a Boolean type and a boolean type. This code gives me no annotation warnings in Eclipse.

share|improve this answer
add comment

This is due to you having Java version set to something other than 1.6. Go to project->properties->Java compiler and set compliance level to 1.6

share|improve this answer
add comment

Check your super-class and get the method signature from there, including visibility (private, protected, public...) return type, method name, and arguments.

share|improve this answer
add comment
