Android update user have parse.com -
i have user score 5. after want update user score 6. can me.
parseuser user = parseuser.getcurrentuser(); if (user == null){ return; } if (username.equals(user.getusername())) { user.put(playermodel.parse_field_score_player, 6); user.signupinbackground(new signupcallback() { @override public void done(final parseexception e) { if (e != null) { log.e(">>>>>playerprovider",e.getmessage()); } } }); }
after change same code bellow, no success. can me.
user.saveinbackground(new savecallback() { public void done(com.parse.parseexception e) { // todo auto-generated method stub if (e != null) { log.e(">>>>>playerprovider",e.getmessage()); } else { } } });
log error
09-30 10:23:13.512 19848-19848/com.demo.b e/>>>>>playerprovider﹕ username vbox86pvbox86p16samsung galaxy s3 - 4.1.1 - api 16 - 720x1280000000000000000310260000000000 taken
you can use incremen
.
docs here: https://parse.com/docs/android/guide#objects-counters
ex:
parseuser user = parseuser.getcurrentuser(); user.incremen(playermodel.parse_field_score_player); user.saveinbackground();
edited:
parseuser user = parseuser.getcurrentuser(); parsequery<parseuser> query = parseuser.getquery(); query.getinbackground(user.getobjectid(), new getcallback<parseuser>() { @override public void done(parseuser parseuser, parseexception e) { if (e == null) { parseuser.put(playermodel.parse_field_score_player, 9999); parseuser.saveinbackground(); } } });
Comments
Post a Comment