b1065579
b1065579

Reputation: 155

Get RealmResults list inside object android

Sorry for my english. I have adapter extends RealmBaseAdapter for auto update listview. And i have object

People

String id;
String name;
RealmList<Dog> dogs;

Dog

String id;
String name;

I need by id People get dogs list. I cant undestand how do this.

I do like this

RealmResults<People> realmQuery = realm
                    .where(People.class)
                    .equalTo("id", "myId")
                    .findAll();

but now i get only one people, but i need get RealmResults dog.

Upvotes: 0

Views: 598

Answers (1)

Tim
Tim

Reputation: 43314

In the onClick handler when you press on a user, do

RealmResult<Dog> realmResults = user.getDogs().where().findAll();

You can query a RealmList. By saying where() you say "give me all of them". And it gives you a RealmResult.

Upvotes: 2

Related Questions