In realm, how to query from a RealmList (Android)

12,712

Just use RealmList.where() to create a query. You can find document here

For example: RealmList<Mail> mails = person.getMails(); RealmResults<Mail> results = mails.where().equalTo("id", 1).findAllSortedAsync();

Share:
12,712
guness
Author by

guness

I am a lifetime student due to my eagerness to learning. I took care my work just like a a good father take care of his children.

Updated on June 14, 2022

Comments

  • guness
    guness almost 2 years

    Check out following classes:

    class Person{
        int id;
        String name;
        RealmList<Mail> mails;
        ...
    }
    
    class Mail{
        int id;
        String content;
        ...
    }
    

    I have a Person object (ie: mPerson) and I am accessing all Mails of the Person object by mPerson.getMails(). Till here everything is cool.


    Here is the question: Is there way to query over the returned list such as findAllSortedAsync()?