2 回答
TA贡献1887条经验 获得超5个赞
删除 getter-setter 并添加空构造函数
ModelUser.java
public class ModelUser {
public String id;
public String username;
public String imageURL;
public ModelUser(String id, String username, String imageURL) {
this.id = id;
this.username = username;
this.imageURL = imageURL;
}
public ModelUser() {
}
}
尝试这个
TA贡献1876条经验 获得超5个赞
它不需要删除 setter getter,
那么从此
public class ModelUser {
private String id;
private String username;
private String imageURL;
public ModelUser(String id, String username, String imageURL) {
this.id = id;
this.username = username;
this.imageURL = imageURL;
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getImageURL() {
return imageURL;
}
public void setImageURL(String imageURL) {
this.imageURL = imageURL;
}
}
只需添加一个空的构造函数即可正常工作:)
public class ModelUser {
public String id;
public String username;
public String imageURL;
public ModelUser(String id, String username, String imageURL) {
this.id = id;
this.username = username;
this.imageURL = imageURL;
}
//Add this
public ModelUser() {
}
public String getId() {
return id;
}
public void setId(String id) {
this.id = id;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getImageURL() {
return imageURL;
}
public void setImageURL(String imageURL) {
this.imageURL = imageURL;
}
}
添加回答
举报