在仪表板中解析对象不保存

时间:2016-04-18 04:22:38

标签: java android parse-platform

当我尝试在我的Android应用程序中保存ParseObject时,它似乎没有保存到仪表板。似乎没有错误显示。这是我的代码。

N.B:代码嵌套在protected void onCreate(Bundle savedInstanceState)


continue_reg.setOnClickListener(new OnClickListener() {

        public void onClick(View arg0) {
            firstNameTxt = first_name.getText().toString();
            lastNameTxt = last_name.getText().toString();

            if (firstNameTxt.equals("") && lastNameTxt.equals("")) {
                Toast.makeText(getApplicationContext(), "Please complete all fields", Toast.LENGTH_LONG).show();

            } else {

                ParseObject patientInfo = new ParseObject("PatientInformation");
                patientInfo.put("firstName", firstNameTxt);
                patientInfo.put("lastName", lastNameTxt);
                patientInfo.saveInBackground();

                Toast.makeText(getApplicationContext(), "Complete", Toast.LENGTH_LONG).show();
            }
        }
    });

1 个答案:

答案 0 :(得分:0)

尝试使用SaveCallback(),以便查看是否出现任何错误。

patientInfo.saveInBackground(new SaveCallback() {
                                @Override
                                public void done(ParseException e) {
                                    if (e == null) {                                          
                                        // No error, the object was saved
                                        Toast.makeText(getApplicationContext(), "Complete", Toast.LENGTH_LONG).show();
                                    } else {
                                        // Error saving object, print the logs
                                        e.printStackTrace();
                                    }
                                }
                            });