Mehdi
Mehdi

Reputation: 792

Query for pointers in Parse Sdk Android

I have a Favorite class that has a pointer to a class called Location as one of its location fields. I want to query the Favorite class and retrieve all objects that point to a certain Location object. In javascript I just create a Location object, set the id to the objectId of the location I am interested in and query for Favorite where location is equal to that object.

But in android there is no way I can set the objectId. Also setting the query just to the string of the objctId is not working.

// 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(...

Upvotes: 1

Views: 550

Answers (1)

Salman Khan
Salman Khan

Reputation: 11

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

Upvotes: 1

Related Questions