Android Parse finding a result using a Pointer Id

I'm trying to get a query using as condition the Pointer Id of the object, for example I'm saving all the id's of an object in an array, then I want to get from another class (related by pointer), all the objects that uses that Id, so I already have this:

for (i = 0; i < num; i++) {
     //restaurant.setObjectId(restId[i]);

        ParseQuery<ParseObject> resultsitems = ParseQuery.getQuery("Item").whereEqualTo ("restaurant", restId[i]);

        try {
            objects=resultsitems.find();
        } catch (ParseException e) {
            e.printStackTrace();
        }

       (.......)
}

In my first try I tried to set the id into the restaurant object, then tried to use the query as:

ParseQuery<ParseObject> resultsitems = ParseQuery.getQuery("Item").whereEqualTo ("restaurant",restaurant );

But it didn't work, then I tried to search as shown in the code above, it doesn't crash but brings me nothing, how can I do this?

Answers


This is what really worked for me:

ParseObject obj = ParseObject.creatWithoutData("classNameThatPointedTo","fieldValue"); 
query.whereEqualTo("fieldName", obj);

Use: .findInBackground(new FindCallBack<Item>... (this will auto-complete in Android Studio), then put objects=resultsitems.find(); in the curly braces of the done() function.

The callback waits for the query to return before moving on with the script. Otherwise, the main thread will keep moving on without waiting for the data to come back from the server.


Need Your Help

Error 193 debugging msi installer execution using cdb

windows debugging windows-installer

When trying to debug the installation process of a msi installer using CDB as,

pytables 3.0 cant find hdf 1.8.12 after homebrew update and wont revert to 1.8.11

homebrew pytables

I have a weird problem. I updated my hdf version via homebrew from 1.8.11 to 1.8.12. Of course pytables got mad cause it was build against 1.8.11 so I re-installed via pip. But now pytables complains