Question

let`s say I have two objects (classes) Category and Work. I want to save new Work with Category relation. Any ideas how to do that?

Était-ce utile?

La solution

This is a pretty basic thing covered in the documentation here.

In your case you would have a category property on your Work object that would be an object pointer to a Category class (table).

// assuming you have myWork and myCategory as instances of ParseObject
myWork.put('category', myCategory);

If you only have the objectId of the Category then you do the following:

myWork.put('category', ParseObject.createWithoutData('Category', categoryId));

Autres conseils

But now I want to get info from database.

ParseQuery<ParseObject> query = ParseQuery.getQuery("Event");
        query.whereEqualTo("user", userID);

        query.findInBackground(new FindCallback<ParseObject>() {
          public void done(List<ParseObject> commentList, ParseException e) {
              System.out.println(commentList);
          }
        });

And after that I got empty response.

SOLVED.

Licencié sous: CC-BY-SA avec attribution
Non affilié à StackOverflow
scroll top