Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/android/216.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Android领域-使用链接作为where子句_Android_Realm - Fatal编程技术网

Android领域-使用链接作为where子句

Android领域-使用链接作为where子句,android,realm,Android,Realm,我有两节课 城市级 private int id; private String cityName; 人类 private int id; private String personName; private long dob; private City hometown; 我想知道怎样才能得到一份住在某个城市的人的名单 我的第一次尝试是这样的 RealmResults <Person> people = realm.where(Person.class).equalTo("ho

我有两节课

城市级

private int id;
private String cityName;
人类

private int id;
private String personName;
private long dob;
private City hometown;
我想知道怎样才能得到一份住在某个城市的人的名单

我的第一次尝试是这样的

RealmResults <Person> people = realm.where(Person.class).equalTo("hometown", "(1, Melbourne)").findAll();
因此,我想知道如何将链接作为“equalTo()”方法中的第二个参数传递。

RealmResults people=realm.where(Person.class).equalTo(“hom乡.cityName”,“墨尔本”).findAll();
RealmResults people=realm.where(Person.class).equalTo(“家乡.城市名称”,“墨尔本”).findAll();

谢谢你,伙计!这正是我想要的!谢谢你,伙计!这正是我想要的!
java.lang.IllegalArgumentException: Field 'hometown': type mismatch. Was STRING, expected LINK
RealmResults <Person> people = realm.where(Person.class).equalTo("hometown.cityName", "Melbourne").findAll();