Luc*_*rro 4 android realm realm-list realm-mobile-platform
我在 android 中使用领域,我收到此错误消息:错误:不支持类型为“java.util.List”的字段“items”。
它在这一行:
private List<Item> items;
Run Code Online (Sandbox Code Playgroud)
这是课程:
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;
}
Run Code Online (Sandbox Code Playgroud)
}
有谁能够帮助我?
小智 7
不幸的是 RealmDatabase 不支持
List<>. 但是您可以通过使用来获得相同的结果RealmList:)
Realm 支持 RealmObject 和 RealmList 的子类来建模关系。
来自:https : //realm.io/docs/java/latest
| 归档时间: |
|
| 查看次数: |
2053 次 |
| 最近记录: |