OnClickListener()必须覆盖超类的方法? [英] OnClickListener() must override a superclass method?

查看:760
本文介绍了OnClickListener()必须覆盖超类的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过这个code:

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
. . .

Button buttonAuthorizeUsers = (Button) findViewById(R.id.buttonAuthorizeUsers);
    buttonAuthorizeUsers.setOnClickListener(new OnClickListener() {
        @Override
        public void onClick(View v) {
            Intent configure = new  Intent(OnDemandAndAutomatic_Activity.this, Configure_Activity.class);  
            OnDemandAndAutomatic_Activity.this.startActivity(configure); 
        }
      });

我收到:

类型的方法的onClick(视图)新View.OnClickListener(){}必须覆盖一个超类方法

这似乎是这个问题有时会引起工程|属性| Java编译器被设置为1.5

It would seem that this problem is sometimes caused by a Project | Properties | Java Compiler being set to 1.5.

虽然我几乎我才喝了这个问题,并将其更改为1.6,不知何故,又是1.5。

Although I'm virtually I'd had this problem before, and changed it to 1.6, somehow it WAS 1.5 again.

然而,(改变它至1.6)没有解决问题。我仍然得到同样的错误消息,清洁,建成后,和F11ing ... ???

HOWEVER, that (changing it to 1.6) did not solve the problem. I'm still getting that same err msg, after cleaning, building, and F11ing...???

推荐答案

我会建议您取消选中启用项目的具体设置,单击配置工作区设置...,改变编译器符合性级别,以1.6或以上。否则,你将不得不每次都指定它。

I would recommend that you uncheck "Enable project specific settings", click "Configure Workspace Settings..." and change "Compiler Compliance Level" to 1.6 or above. Otherwise you would have to specify it every time.

如果你需要为特定项目具体合规水平,你需要验证需要符合水平1.6或以上即设置为所有其他项目。

If you need a specific compliance level for a specific project, you need to verify every other project that need compliance level 1.6 or above is set to this.

在一切都正确安装 - 清洁​​工程和重新启动Eclipse 。 Eclipse可以是这样一个婊子一些时间 - 这通常能解决问题,我

After everything is correctly setup - clean projects and restart Eclipse. Eclipse can be such a bitch some times - this often solves problems for me.

这篇关于OnClickListener()必须覆盖超类的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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