2017-02-04 112 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));