为什么日食不断凸显的方法? [英] Why does eclipse keeps highlighting a method?

查看:102
本文介绍了为什么日食不断凸显的方法?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想覆盖的方法onItemClick。我会把我的进口和方法如下:

I am trying to override the method onItemClick. I will put my imports and methods below:

import android.app.Activity;
import android.app.ListActivity;
import android.content.ContentUris;
import android.content.Intent;
import android.database.Cursor;
import android.net.Uri;
import android.os.Bundle;
import android.provider.Contacts.People;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ListView;
import android.widget.SimpleCursorAdapter;
import android.widget.TextView;
import android.widget.AdapterView.OnItemClickListener;

public class ListViewActivityActivity extends ListActivity implements OnItemClickListener {

    @Override 
    public void onItemClick(AdapterView adview, View target, int position, long id) {}

}

我的问题是为什么 onItemClick 方式保持下划线?我究竟做错了什么? 我试着重装项目,它并没有帮助。任何人都运行到同样的问题?

My question is why does onItemClick method keep underlining? What am I doing wrong? I tried reloading project and it didn't help. Anybody run in to the same problem?

PS当我悬停它说:类型ListViewActivityActivity的方法onItemClick(适配器视图,视图的int,long)必须覆盖一个超类方法

PS when I hover over it it says : The method onItemClick(AdapterView, View, int, long) of type ListViewActivityActivity must override a superclass method

推荐答案

您项目的Java编译器级别设置为1.5。该 @覆盖注释是不允许的一类用Java实现1.5接口方法;这仅仅是从Java 1.6起允许的。

Your project has the Java compiler level set to 1.5. The @Override annotation is not allowed for a class implementing an interface method in Java 1.5; this is only allowed from Java 1.6 onward.

进入您的项目属性(项目的上下文菜单),选择 Java编译器和编译器遵从性级别设置为1.6。

Go into your project properties (project's context menu), select Java Compiler and set the compiler compliance level to 1.6.

这篇关于为什么日食不断凸显的方法?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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