方法声明无效;返回类型必需的android studio
请帮帮我 错误:(8,12)错误:方法声明无效;需要返回类型方法声明无效;返回类型必需的android studio,android,Android,请帮帮我 错误:(8,12)错误:方法声明无效;需要返回类型 public NavDrawerItem() { } public NavDrawerItem(boolean showNotify, String title) { this.showNotify = showNotify; this.title = title; } 创建新构造函数时,构造函数的名称必须与类名完全相同,在本例中为navdraw 您需要研究错误以找到解决方案。 重复:您的类的名称为nav
public NavDrawerItem() {
}
public NavDrawerItem(boolean showNotify, String title) {
this.showNotify = showNotify;
this.title = title;
}
创建新构造函数时,构造函数的名称必须与类名完全相同,在本例中为navdraw 您需要研究错误以找到解决方案。
重复:您的类的名称为
navdraw
,但您正在为NavDrawerItem
创建构造函数。因此,Java编译器认为您实际上想要创建简单的方法并请求返回类型,例如,public int-NavDrawerItem(){}
(这不起作用)
解决方案:将您的类重命名为NavDrawerItem