2017-02-04 113 views
0

我有一个Favorite类,它有一个指向名为Location的类的指针作为其位置字段之一。我想查询Favorite类并检索指向某个Location对象的所有对象。在javascript中,我只是创建一个Location对象,将id设置为我感兴趣的位置的objectId,并在其中位置等于该对象时查询Favorite。Parse Sdk中的指针查询Android

但在android中,我无法设置objectId。还将查询设置为objctId的字符串不起作用。

// Something I would have expected existed 
//ParseObject location = new ParseObject("Location"); 
//location.setObjectId(locationId); 

final ParseQuery<ParseObject> query = ParseQuery.getQuery("Favorite"); 
// if I had the location object, but I only have the locationId 
//query.whereEqualTo("location", location); 

query.whereEqualTo("location", locationId); 
query.findInBackground(... 

回答

0
query.whereEqualTo("location",Parse.createWithoutData(reference_classname,ObjectId));