Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android

parse

i want to create multiple objects with fields on parse, instead of just the message object on the ribbit app, how do i do this....

3 Answers

Hi. Other ParseObjects on the parse backend can be created in the same way as the message object was created in the Ribbit project. Here's an example from the Parse.com docs:

ParseObject gameScore = new ParseObject("GameScore");
gameScore.put("score", 1337);
gameScore.put("playerName", "Sean Plott");
gameScore.put("cheatMode", false);
gameScore.saveInBackground();

The first line creates a new ParseObject called "GameScore", adds a field called "score" with the value of '1337'. Adds several other fields and values, and then saves the object to the Parse.com backend in the final line.

The guide from Parse.com here: https://www.parse.com/docs/android_guide is pretty good in MOST respects. ;)

Let us know if you have anymore questions.

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Based on extra info in your tweet, it sounds like your idea is to tie multiple objects to a single message. Just like James Pamplona said, you can create additional objects in your code just like that example and like what we show in the course. You provide the class name and add the fields you want.

The trick of tying them together is to use the Object ID of your Message class to relate the objects together. You can use a ParseRelation to relate the message to each object, or you could even include the ObjectIDs of each object in the message. If it is four different objects, you might one one field for each object ID.

Thanks...