我正在尝试使用ID作为参考从Realm获取数据.但是,在查询ID时,我发现Realm为所有元素(ID为0)提供了相同的ID.当我@PrimaryKey在模型的ID上使用注释时,为什么ID不会自动递增?
这是模型的缩短类:
public class Child_pages extends RealmObject {
@PrimaryKey
private int id_cp;
private int id;
private String day;
private int category_id;
Run Code Online (Sandbox Code Playgroud)
我正在执行的查询是: realm.where(Child_pages.class).equalTo("id_cp",page_id).findFirst()
我需要一个list<Object>使用Realm.我试过RealmList<RealmObject>但它不起作用,因为它RealmObject是抽象的.