Learner Always
Learner Always

Reputation: 1936

Parse.com Data not saving to different tables/objects

I'm using Parse.com service for an Android app (using 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

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

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

Upvotes: 0

Views: 334

Answers (1)

berserk
berserk

Reputation: 2728

You forgot to call

student.saveInBackground(); 

Upvotes: 1

Related Questions