Android 领域数据库-不支持类型为x的字段
我正在android中使用realm,收到以下错误消息: 错误:不支持类型为“java.util.List”的字段“items” 在这条线上:Android 领域数据库-不支持类型为x的字段,android,realm,realm-mobile-platform,realm-list,Android,Realm,Realm Mobile Platform,Realm List,我正在android中使用realm,收到以下错误消息: 错误:不支持类型为“java.util.List”的字段“items” 在这条线上: private List<Item> items; 私有列表项; 下面是课堂: public class Article extends RealmObject implements Serializable{ @PrimaryKey private String category; private List<Item> i
private List<Item> items;
私有列表项;
下面是课堂:
public class Article extends RealmObject implements Serializable{
@PrimaryKey
private String category;
private List<Item> items;
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public List<Item> getItems() {
return items;
}
public void setItems(List<Item> items) {
this.items = items;
}
公共类文章扩展RealmObject实现可序列化{
@主键
私有字符串类别;
私人清单项目;
公共字符串getCategory(){
退货类别;
}
公共无效集合类别(字符串类别){
this.category=类别;
}
公共列表getItems(){
退货项目;
}
公共无效集合项(列表项){
这个项目=项目;
}
}
有人能帮我吗 不幸的是RealmDatabase不支持
列表
。但您可以通过使用RealmList
:)获得相同的结果
Realm支持RealmObject和RealmList的子类来建模关系
发件人: