Eclipse的靛蓝不允许@覆盖非活动覆盖的方法 [英] Eclipse Indigo does not allow @Override for non Activity overwritten methods

查看:151
本文介绍了Eclipse的靛蓝不允许@覆盖非活动覆盖的方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Eclipse靛蓝为Android的发展。我面对的问题是,它不允许@Override用于非活动覆盖的方法。例如,如果我的MediaPlayer实现的onErrorListner,我设定它,然后属性@覆盖它提供了以下编译时错误:

I am using Eclipse Indigo for Android development. The problem i face is that it does not allow @Override for non Activity overwritten methods. For example if i implement onErrorListner of MediaPlayer and i set attribute @Override with it then it gives the following compile time error:

The method onError(MediaPlayer, int, int) of type MyActivity must override a superclass method

和解决这个问题,我提出以下

And to fix this problem, i am suggested the following

Remove "@Override" annotation

刚猛删除@覆盖解决这个问题,但为什么它抱怨,也删除它可能会导致停止其母公司等一些功能?

Tough removing the @Override fixes the issue but why does it complain about it and also removing it may cause stopping some functionality of its parent etc??

我已经下载了该用这种@Override与证明,这是用来和我可能会丢失一些显而易见的事情非活性的方法属性的例子很多。但我不能没有从所有类别中删除这些@Override属性在Eclipse中运行靛蓝这些例子。

I have downloaded many examples which use this "@Override" attribute with non-activity methods which proves that this is used and i might be missing some obvious thing. But i cannot run these examples in Eclipse Indigo without removing these "@Override" attributes from all the classes.

为什么?

任何帮助是极大AP preciated。

Any help is greatly appreciated.

推荐答案

您的项目Java编译器级别设置为1.5,而不是1.6。见<一href=\"http://stackoverflow.com/questions/9213421/why-does-eclipse-keeps-highlighting-a-method/9219594#9219594\">here.

Your project Java compiler level is set to 1.5 instead of 1.6. See here.

这篇关于Eclipse的靛蓝不允许@覆盖非活动覆盖的方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆