Check two fields with Realm database

喜夏-厌秋 提交于 2019-12-10 12:40:02

问题


How can I create an and operation with Realm?

Example I have an object with day and month and I want to check both those fields values.

Something like :

 RealmResults<Event> toEdit = realm.where(Event.class)
        .equalTo("day", day)
        .and
        .equalTo("month", month)
        .findAll();

But as far as I can tell there is no and operator.

Thank you


回答1:


Multiple conditions are combined with And unless there's an .or() between them, so it's just:

 RealmResults<Event> toEdit = realm.where(Event.class)
        .equalTo("day", day)
        .equalTo("month", month)
        .findAll();


来源:https://stackoverflow.com/questions/32461425/check-two-fields-with-realm-database

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!