Advertisement
yo2man

Parse comment doc

Aug 18th, 2015
229
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.82 KB | None | 0 0
  1. Objects can have relationships with other objects. To model this behavior, any ParseObject can be used as a value in other ParseObjects. Internally, the Parse framework will store the referred-to object in just one place, to maintain consistency.
  2.  
  3. For example, each Comment in a blogging app might correspond to one Post. To create a new Post with a single Comment, you could write:
  4.  
  5. // Create the post
  6. ParseObject myPost = new ParseObject("Post");
  7. myPost.put("title", "I'm Hungry");
  8. myPost.put("content", "Where should we go for lunch?");
  9.  
  10. // Create the comment
  11. ParseObject myComment = new ParseObject("Comment");
  12. myComment.put("content", "Let's do Sushirrito.");
  13.  
  14. // Add a relation between the Post and Comment
  15. myComment.put("parent", myPost);
  16.  
  17. // This will save both myPost and myComment
  18. myComment.saveInBackground();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement