我应该编译哪个版本的 Android 以避免内部类警告
我正在使用 Android 2.1 (update1),项目的 IntelliJ 项目设置显示:
JDK 1.6 并且我的项目语言级别设置为 6.0(接口中的@Override)
但是当我在 IDE 内部或外部使用 Maven 进行构建时我收到以下
警告: 忽略匿名内部类的 InnerClasses 属性
这行代码(可能)是问题,但如果是这样,我“应该”如何在 1.6 友好构建中执行此操作 安卓?
public class HelloAndroidActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button viewButton = (Button) findViewById(R.id.loadViewBtn);
viewButton.setOnClickListener(new View.OnClickListener() {
@Override //this says override is not allowed when impl interface method??
public void onClick(View view) {
Intent viewActivity = new Intent(HelloAndroidActivity.this, ViewPhotosActivity.class);
startActivity(viewActivity);
}
});
I'm working with Android 2.1 (update1) and my IntelliJ project settings for the project show:
JDK 1.6 and my project language level is set to 6.0 (@Override in interfaces)
Yet when I do a build inside the IDE or outside with Maven I get the following
warning: Ignoring InnerClasses attribute for an anonymous inner class
This line of code (might) be the issue but if so how "should" i do this in a 1.6 friendly build of Android?
public class HelloAndroidActivity extends Activity {
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.main);
final Button viewButton = (Button) findViewById(R.id.loadViewBtn);
viewButton.setOnClickListener(new View.OnClickListener() {
@Override //this says override is not allowed when impl interface method??
public void onClick(View view) {
Intent viewActivity = new Intent(HelloAndroidActivity.this, ViewPhotosActivity.class);
startActivity(viewActivity);
}
});
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
只需删除文本
@override
just delete the text
@override