How to copy a ParseObject to a new ParseObject in different class

There is no function to copy a ParseObject into another class. In order to do so, one will need to create a ParseObject of the new class and re-assign all the keyset into the new ParseObject.

ParseObject is kinda like a Map object, so it is easy to retrieve all available keys, just as what you will do with a map.

ParseObject sourceObject = sourceParseObject;
ParseObject targetObject = new ParseObject("NewClass");
for (Iterator it = sourceObject.keySet().iterator(); it.hasNext();) {
      Object key = it.next();
      targetObject.put(key.toString(),sourceObject.get(key.toString());
    }
Advertisements

Posted on August 8, 2015, in Education and tagged , , . Bookmark the permalink. Leave a comment.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: