I just started using Parse. According to their Android documentation, you need to add the queue ParseObject to the location ParseObject before you store them (or vice versa).
Assuming you put the relationship between the two in the location object, , you should be able to pull the queue with something like this:
Storing:
// Create location
ParseObject location = new ParseObject("Location");
location.put("foo", "bar");
// Create queue
ParseObject queue = new ParseObject("Queue");
queue.put("name", "Ben");
// Store the queue in the location (location will contain a pointer to queue)
location.put("Queue", queue);
// Save both location and queue
location.saveInBackground();
Retrieving:
// Retrieve location using objectId
ParseQuery query = new ParseQuery("Location");
query.getInBackground("QkKt30WhIA", new GetCallback() { // objectId!
public void done(ParseObject object, ParseException e) {
if (e == null) {
// Location found! Query for the queue
object.getParseObject("Queue").fetchIfNeededInBackground(new GetCallback() {
public void done(ParseObject object, ParseException e) {
// Queue found! Get the name
String queueAttr = object.getString("name");
Log.i("TEST", "name: " + queueAttr);
}
});
}
else {
// something went wrong
Log.e("TEST", "Oops!");
}
}
});