我无法在解析中更新对象

时间:2014-04-07 19:43:30

标签: android parsing background save

我是使用解析服务的新手,我正在学习如何使用它。实际上我想更新解析数据库中的对象。它工作得很好,但是当我使用函数“object.saveInBackground()”时,没有任何事情发生。这是我的代码:

public class ParseApplication extends Application {

public void onCreate() {
    super.onCreate();

    Parse.initialize(this, MY_APPLICATION_ID, MY_CLIENT_KEY);

    ParseUser.enableAutomaticUser();
    ParseACL defaultACL = new ParseACL();

    defaultACL.setPublicReadAccess(true);

    ParseACL.setDefaultACL(defaultACL, true);

        ParseQuery<ParseObject> query = ParseQuery.getQuery("GameScore");


            query.getInBackground("OBJECT_ID", new GetCallback<ParseObject>() {
              public void done(final ParseObject gameScore, ParseException e) {
                if (e == null) {

                    Toast toast1 = Toast.makeText(getApplicationContext(), Boolean.toString( gameScore.getBoolean("cheatMode")), Toast.LENGTH_SHORT);

                    toast1.show();
                    gameScore.put("cheatMode", true);

                    Toast toast =Toast.makeText(getApplicationContext(), Boolean.toString( gameScore.getBoolean("cheatMode")), Toast.LENGTH_SHORT);
                                toast.show(); 
                                gameScore.saveInBackground();

                            }                   
              }
            });     
}

}

如何在解析中更新对象?

0 个答案:

没有答案