Here I am writing code to add an element to Parse Array.
It is very simple to add values to parse array.
We need to insert using add() or addUnique() instead of put() method.
So for normal column, we use put() method of ParseObject and for array, we use add() method of ParseObject.
Below is the code.
ParseObject parseObject = new ParseObject("Challenge");
parseObject.put("name", nameString);
parseObject.add("array", ParseUser.getCurrentUser());
parseObject.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
if (e == null) {
System.out.println("Success");
} else {
System.out.println("Error : " + e.getMessage());
}
}
});
0 Comment(s)