Android 为属性image找到两个区分大小写冲突的getter或字段
我的logcat说它“找到了两个getter或字段,它们的属性:image的大小写敏感度相互冲突”。我正在使用firebase数据库,我没有名为“image”的子项,而我有一个名为“image”的子项Android 为属性image找到两个区分大小写冲突的getter或字段,android,firebase,firebase-realtime-database,getter,Android,Firebase,Firebase Realtime Database,Getter,我的logcat说它“找到了两个getter或字段,它们的属性:image的大小写敏感度相互冲突”。我正在使用firebase数据库,我没有名为“image”的子项,而我有一个名为“image”的子项 }你的班级应该是这样的: public class BlogCV { public String image, title; public BlogCV() {} public BlogCV(String image, String title){ th
}你的班级应该是这样的:
public class BlogCV {
public String image, title;
public BlogCV() {}
public BlogCV(String image, String title){
this.image = image;
this.title = title;
}
public String getImage() {
return image;
}
public String getTitle() {
return title;
}
}
请查看现在以小写开头的字段。您的类应该如下所示:
public class BlogCV {
public String image, title;
public BlogCV() {}
public BlogCV(String image, String title){
this.image = image;
this.title = title;
}
public String getImage() {
return image;
}
public String getTitle() {
return title;
}
}
请查看现在以小写开头的字段。使用其他库时,请确保遵循Java命名约定。您应该在
camelCase
中使用以小写字母开头的变量名
你的问题不清楚。但是我相信可以通过使用变量名
images
和title
来解决这个问题。在使用其他库时,请确保遵循Java命名约定。您应该在camelCase
中使用以小写字母开头的变量名
你的问题不清楚。但我相信可以通过使用变量名
images
和title
来解决这个问题,应用程序不再崩溃,但我无法从数据库中获取数据。。在将密钥更改为小写字母(图像到图像和标题到标题)后,我可以获取数据。谢谢……)或者,您可以在此处将成员字段标记为非公共字段,以便Firebase仅查找getter。So私有字符串图像、标题代码>也可以。工作几个小时后,我无法解决问题,直到看到你的答案。非常感谢。应用程序不再崩溃,但我无法从数据库获取数据。。在将密钥更改为小写字母(图像到图像和标题到标题)后,我可以获取数据。谢谢……)或者,您可以在此处将成员字段标记为非公共字段,以便Firebase仅查找getter。So私有字符串图像、标题代码>也可以。工作几个小时后,我无法解决问题,直到看到你的答案。非常感谢。