I am trying to remove one object for an array stored in parse (e.g [user1],[user2],[user3], I was to change to [user1],[user3]). I have a module class which stores the different students on the module, when the user removes the module I want to remove their userID from the array stored in the students parse array.
If that is not possible, how can I retrieve the whole array into a local arraylist, edit it, then put it back?
I have attempted a few things but none has worked so far. this is my current code which deletes the whole row and not just the array:
moduleDeleteButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
final View temp = v;
ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("Module");
query.whereEqualTo("moduleCode", getItem(position).getModuleCode());
query.findInBackground(new FindCallback<ParseObject>() {
public void done(List<ParseObject> module, ParseException e) {
if (e == null) {
for (ParseObject delete : module) {
delete.remove(currentUser.getObjectId());
delete.deleteInBackground();
}
Toast.makeText(temp.getContext(), "Deleted", Toast.LENGTH_LONG).show();
} else {
Log.e("Error", e.getMessage());
Toast.makeText(temp.getContext(), "Error deleting", Toast.LENGTH_LONG).show();
}
}
});
}
});
Thanks for any help!