尝试在android中更新/ sve后,ParseObject没有更新

时间:2015-02-23 01:47:15

标签: android parse-platform

我正在尝试在解析时检索表格中的一行。我找到了objectId,但是当我尝试使用新信息更新行时,没有任何反应。任何帮助,将不胜感激。谢谢!

mSaveAndNextSteps.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ParseQuery<SingleFactInfo> query = ParseQuery.getQuery("Fact_Info");
            query.getInBackground(mEventObjectId, new GetCallback<SingleFactInfo>() {
                public void done(ParseObject fact, ParseException e) {
                    if (e == null) {
                        // Now let's update it with some new data. In this case, only cheatMode and score
                        // will get sent to the Parse Cloud. playerName hasn't changed.
                        fact.add("factDescriptiontwo", mEventDescription.getText().toString());
                        event.put("factDescription", mEventDescription.getText().toString());
                        event.saveInBackground(new SaveCallback() {
                            @Override
                            public void done(com.parse.ParseException e) {

                            }
                        });
                    }
                }

                @Override
                public void done(SingleFactInfo parseObject, com.parse.ParseException e) {
                    Intent goToFactLists = new Intent(CreateEventSectionTwo.this, EventList.class);
                    startActivity(goToFactLists);
                }
            });
        }
    });

1 个答案:

答案 0 :(得分:0)

所以这是适合我的工作解决方案。使用objectId查询对象,然后在&#39; done&#39;中更新它。部分。

mSaveAndNextSteps.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            ParseQuery<SingleFactInfo> query = new ParseQuery("Event_Info");
            query.getInBackground(mEventObjectId, new GetCallback<SingleFactInfo>() {
                public void done(ParseObject event, ParseException e) {
                    if (e == null) {
                        // Now let's update it with some new data. In this case, only cheatMode and score
                        // will get sent to the Parse Cloud. playerName hasn't changed.
                        Toast.makeText(getApplicationContext(), mYourEditText.getText().toString(), Toast.LENGTH_LONG).show();
                    }
                }

                @Override
                public void done(SingleFactInfo parseObject, com.parse.ParseException e) {
                    parseObject.put("eventDescription", mYourEditText.getText().toString());
                    parseObject.saveInBackground();
                    Intent goToFactsList = new Intent(YourApplication.this, EventList.class);
                    startActivity(goToFactsList);
                }
            });
        }
    });