嘿伙计们我正在查看parse.com示例和文档,但是我们无法弄清楚如何更改存储在解析类中的列中的某些内容的值(特别是字符串)这是一个数字,例如,列名:ExampleColumn - 字符串 - 5)。例如,我想在点击按钮时做这样的事情
@Override
public void onClick(View arg0) {
ParseQuery<ParseObject> query = new ParseQuery<ParseObject> ("ExampleClass");
ExampleColumn = ExampleColumn + 1; /* obviously this won't work but it shows exactly what i want to do with the column, so that this would make ExampleColumn = 6 */
}
答案 0 :(得分:1)
使用Parse,您不能直接使用列。您使用对象。因此,如果要更改“列”的值,则需要
答案 1 :(得分:0)
如果列数据类型是字符串,则必须在增加之前将其转换为整数。
ParseQuery query = new ParseQuery ("ExampleClass");
query.whereEqualTo("objectId",your_object_id);
query.getFirstInBackground(new GetCallback<ParseObject>() {
public void done(ParseObject object, ParseException e) {
if (object == null) {
Log.d("score", "The getFirst request failed.");
} else {
int val=Integer.parseInt(object.getString("exampleColumn"));
val++;
object.put("exampleColumn",val);
object.saveInBackground();
}
}
});