Android 更新用户有 parse.com
Android update user have parse.com
我有一个得分为 5 的用户。我想更新得分为 6 的用户。你能帮帮我吗?
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());
}
}
});
}
我在下面更改了相同的代码,但没有成功。你能帮帮我吗
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 {
}
}
});
记录错误
09-30 10:23:13.512 19848-19848/com.demo.b E/>>>>>PlayerProvider﹕ username vbox86pvbox86p16Samsung Galaxy S3 - 4.1.1 - API 16 - 720x1280000000000000000310260000000000 already taken
您可以使用 incremen
.
文档在这里:https://parse.com/docs/android/guide#objects-counters
例如:
ParseUser user = ParseUser.getCurrentUser();
user.incremen(PlayerModel.PARSE_FIELD_SCORE_PLAYER);
user.saveInBackground();
已编辑:
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();
}
}
});
我有一个得分为 5 的用户。我想更新得分为 6 的用户。你能帮帮我吗?
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());
}
}
});
}
我在下面更改了相同的代码,但没有成功。你能帮帮我吗
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 {
}
}
});
记录错误
09-30 10:23:13.512 19848-19848/com.demo.b E/>>>>>PlayerProvider﹕ username vbox86pvbox86p16Samsung Galaxy S3 - 4.1.1 - API 16 - 720x1280000000000000000310260000000000 already taken
您可以使用 incremen
.
文档在这里:https://parse.com/docs/android/guide#objects-counters
例如:
ParseUser user = ParseUser.getCurrentUser();
user.incremen(PlayerModel.PARSE_FIELD_SCORE_PLAYER);
user.saveInBackground();
已编辑:
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();
}
}
});