简体   繁体   English

Parse.com数据未保存到其他表/对象

[英]Parse.com Data not saving to different tables/objects

I'm using Parse.com service for an Android app (using eclipse adt) 我正在为Android应用程序使用Parse.com服务(使用eclipse adt)

I'm trying to take student data from the app user and push the same to two different tables/classes (both are respectively created in the parse dashboard). 我正在尝试从应用程序用户那里获取学生数据,并将其推到两个不同的表/类中(两者都分别在解析仪表板中创建)。

Form is common, but details of the student goes to table named student, and text fields from marks go into 'marks' class/table 形式很常见,但学生的详细信息会转到名为“ student”的表,而标记的文本字段将进入“标记”类/表

But, the code doesn't save to the second table. 但是,代码不会保存到第二个表。 It does however save to the first table. 但是,它确实保存到第一张表。 Kindly help. 请帮助。

Code part is self explanatory. 代码部分不言自明。 Here's my code: 这是我的代码:

Java File 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();

    }

}

Thanks 谢谢

你忘了打电话

student.saveInBackground(); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM