代码如下:
在数据库中查找用户:
private void updataUserRated() {
final ParseQuery<ParseObject> userObject = ParseQuery.getQuery("User");
userObject.whereEqualTo("objectId", userId);
userObject.findInBackground(new FindCallback<ParseObject>() {
@Override
public void done(List<ParseObject> objects, ParseException e) {
如何从用户中找到一个objectid来保存带解析的ratingBar的值?
if (e == null) {//sucess
userObject.getInBackground("#########", new GetCallback<ParseObject>() {
@Override
public void done(ParseObject object, ParseException e) {
if (e == null){//sucess
object.put("rated", ratingBar.getRating());
object.saveInBackground(new SaveCallback() {
@Override
public void done(ParseException e) {
Toast.makeText(FeedUserActivity.this, "Sucesso ao enviar", Toast.LENGTH_LONG).show();
}
});
}else {
Toast.makeText(FeedUserActivity.this, "Error 1" + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
} else {
Toast.makeText(FeedUserActivity.this, "Error 2" + e.getMessage(), Toast.LENGTH_LONG).show();
}
}
});
}
答案 0 :(得分:0)
const objectId = userObject.id;