Parse.com数据不保存到不同的表/对象

时间:2014-10-28 16:16:40

标签: java android mysql eclipse parse-platform

我正在将Parse.com服务用于Android应用(使用eclipse adt)

我正在尝试从应用用户那里获取学生数据并将其推送到两个不同的表/类(两者都分别在解析仪表板中创建)。

表单很常见,但学生的详细信息会转到名为student的表格,而标记中的文本字段会转到“标记”类/表

但是,代码不会保存到第二个表。然而它确实保存到第一个表。 请帮助。

代码部分是自我解释的。这是我的代码:

Java文件

package com.parse.starter;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.view.View.OnClickListener;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.parse.ParseAnalytics;
import com.parse.ParseObject;

public class ParseStarterProjectActivity extends Activity implements OnClickListener {
       private EditText et1,et2,et3,et4,et5,et6;
       private Button button1;
    /** Called when the activity is first created. */
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.main);
           et1 = (EditText) findViewById(R.id.editText1);
              et2 = (EditText) findViewById(R.id.editText2);
              et3 = (EditText) findViewById(R.id.editText3);
              et4 = (EditText) findViewById(R.id.editText4);
              et5 = (EditText) findViewById(R.id.editText5);
              et6 = (EditText) findViewById(R.id.editText6);
              button1 = (Button) findViewById(R.id.button1);
              button1.setOnClickListener(this);


    }


    @Override
    public void onClick(View arg0) {
        // TODO Auto-generated method stub
        String name = et1.getText().toString();
        String address = et3.getText().toString();
        String mobile = et2.getText().toString();
        String marks1 = et4.getText().toString();
        String marks2 = et5.getText().toString();
        String marks3 = et6.getText().toString();
         ParseObject studentDetails = new ParseObject("Student");
         ParseObject student = new ParseObject("marks");

         studentDetails.put("name", name);
         studentDetails.put("address", address);
         studentDetails.put("mobile", mobile);

         student.put("marks1", marks1);
         student.put("marks2", marks2);
         student.put("marks3", marks3);
         studentDetails.saveInBackground(); 
         Toast.makeText(this,"saved", Toast.LENGTH_LONG).show();

    }

}

由于

1 个答案:

答案 0 :(得分:1)

你忘了打电话了

student.saveInBackground();