Last Updated
Viewed 40 Times

I have made a user table that looks as which includes a custom Name field .

Now whenever I try to put data into this field i get an error .

The code i Used was .

ParseUser user = new ParseUser();
                user.setUsername(Name);
                user.setPassword(Password);
                user.setEmail("nevin.george.sunny@gmail.com");


                user.put("Name","test");

                user.signUpInBackground(new SignUpCallback() {
                    @Override
                    public void done(ParseException e) {
                        if (e == null) {
                            // Show a simple Toast message upon successful registration
                            Toast.makeText(getApplicationContext(),
                                    "Successfully Signed up, please log in.",
                                    Toast.LENGTH_LONG).show();
                        } else {
                            Toast.makeText(getApplicationContext(),
                                    "Sign up Error", Toast.LENGTH_LONG)
                                    .show();
                        }
                    }


                });

But I get the "Sign Up error" Message Displayed .And no updates in the table .

I am using Android Studio for my app and Parse for my database... and on the create an account page I have, it allows the user to enter in first name, last name, email, username, and password.

But my code is using parseUser... I don't know how to set the first and last name in the database. I know setUsername, setPassword, setEmail is a part of it... but what about if you make a column in Parse? How can you add this in your class?

This is a part of my code, what it looks like...my problem is in the else statement I have:

          // Force user to fill up the form
            if (usernametxt.equals("") && passwordtxt.equals("") && emailtxt.equals("")) {
                Toast.makeText(getApplicationContext(),
                        "Please fill in the username, password, and email fields.",
                        Toast.LENGTH_LONG).show();

            } else {
                // Save new user data into Parse.com Data Storage
                ParseUser user = new ParseUser();

                //somehow save first and last name 

                user.setEmail(emailtxt);
                user.setUsername(usernametxt);
                user.setPassword(passwordtxt);
                user.signUpInBackground(new SignUpCallback() {
                    public void done(ParseException e) {
                        if (e == null) {

I wrote that code to send data to parse.com then to receive it also but I can't even send it till now, why ?!! I don't know the main reason, I put the internet and network permission in AndroidManifest.xml the parse class in application also in AndroidManifest.xml

<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.example.mkadaimtwo"
android:versionCode="1"
android:versionName="1.0" >

<uses-sdk
    android:minSdkVersion="8"
    android:targetSdkVersion="21" />

<uses-permission android:name="android.permission.INTERNET" />
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />

<application
    android:name="com.example.mkadaimtwo.ParseCode"
    android:allowBackup="true"
    android:icon="@drawable/ic_launcher"
    android:label="@string/app_name"
    android:theme="@style/AppTheme" >
    <activity
        android:name=".MainActivity"
        android:label="@string/app_name" >
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />

            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
    </activity>
</application>

and also put the parse class in application also in AndroidManifest.xml and that two codes of class and main Activity

ParseCode class Activity :

package com.example.mkadaimtwo;

import com.parse.Parse;

import android.app.Application;

public class ParseCode extends Application {
public void onCreate() {
      Parse.initialize(this, "GIuhlGILKRd8itvCF79femTyReHM6XjVkrfLKm3X",   "Fjg4tBrMgl0mY47K4kCL7hVmXhu8FmkE2on9PlXK");
    }
  }

the MainActivity Code :

package com.example.mkadaimtwo;

   import android.app.AlertDialog;
   import android.app.ProgressDialog;
   import android.net.ParseException;
   import android.os.Bundle;
   import android.support.v7.app.ActionBarActivity;
   import android.view.View;
    import android.widget.EditText;

   import com.parse.GetCallback;
   import com.parse.ParseObject;
   import com.parse.ParseQuery;

   public class MainActivity extends ActionBarActivity {

EditText etCompanyName,etAddress,etNumberOfEmployees,etContactNumber;
ProgressDialog pd,pd2;

@Override
protected void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_main);

    etCompanyName = (EditText) findViewById(R.id.etCompanyName);
    etAddress = (EditText) findViewById(R.id.etAddress);
    etNumberOfEmployees = (EditText) findViewById(R.id.etNumberOfEmployees);
    etContactNumber = (EditText) findViewById(R.id.etContactNumber);

    pd = new ProgressDialog(this);
    pd.setTitle("wait");
    pd.setMessage("by7aml elmafrod");
    pd.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    pd.setCancelable(true);


    pd2 = new ProgressDialog(this);
    pd2.setTitle("wait");
    pd2.setMessage("by7aml elmafrod");
    pd2.setProgressStyle(ProgressDialog.STYLE_SPINNER);
    pd2.setCancelable(true);

    //here we will Load the old company data from Parse.com

    ParseQuery<ParseObject> query = ParseQuery.getQuery("TestBosyApp");
    query.getInBackground("ijy1qi78g8", new GetCallback<ParseObject>() {
        public void done(ParseObject testBosyApp, ParseException e) {
            if (e == null) {

                String companyName = testBosyApp.getString("company_name");
                String address = testBosyApp.getString("address");
                String numberOfEmployees = testBosyApp.getString("number_of_employees");
                String contactNumber = testBosyApp.getString("contact_number");

                etCompanyName.setText(companyName);
                etAddress.setText(address);
                etNumberOfEmployees.setText(numberOfEmployees);
                etContactNumber.setText(contactNumber);

                pd.dismiss();


            } else {
                AlertDialog.Builder mDialoge = new AlertDialog.Builder(MainActivity.this); 
                mDialoge.setTitle("Erorr");
                mDialoge.setMessage("Check el net plz :)");
                mDialoge.setPositiveButton("ok", null);
                mDialoge.show();
            }
        }

        @Override
        public void done(ParseObject arg0, com.parse.ParseException arg1) {
            // TODO Auto-generated method stub

        }

    });

}

  public void update (View V){
    pd2.show();
    //update data in Parse

    ParseQuery<ParseObject> myQuery = ParseQuery.getQuery("TestBosyApp");

    // Retrieve the object by id
    myQuery.getInBackground("U6Gwn2tiD8", new GetCallback<ParseObject>() {
        public void done(ParseObject testBosyApp, ParseException e) {
            if (e == null) {
                //Initials our variables
                String companyName = etCompanyName.getText().toString().trim();
                String address = etAddress.getText().toString().trim();
                String numberOfEmployees = etNumberOfEmployees.getText().toString().trim();
                String contactNumber = etContactNumber.getText().toString().trim();

                //update it with new data

                testBosyApp.put("company_name", companyName);
                testBosyApp.put("address", address);
                testBosyApp.put("number_of_employees", numberOfEmployees);
                testBosyApp.put("contact_number", contactNumber);
                testBosyApp.saveInBackground();

                pd2.dismiss();

                AlertDialog.Builder mDialoge = new AlertDialog.Builder(MainActivity.this); 
                mDialoge.setTitle("2shta");
                mDialoge.setMessage("Keda eldata ra7t t2riban");
                mDialoge.setPositiveButton("cool", null);
                mDialoge.show();
            }else{
                pd2.dismiss();
                AlertDialog.Builder mDialoge = new   AlertDialog.Builder(MainActivity.this); 
                mDialoge.setTitle("Erorr");
                mDialoge.setMessage("Check el net plz :)");
                mDialoge.setPositiveButton("ok", null);
                mDialoge.show();
            }
        }

        @Override
        public void done(ParseObject arg0, com.parse.ParseException arg1) {
            // TODO Auto-generated method stub

            }
    });

}

 }

so what's the problem, progress-bar is loading without end and if I give progress-bar cancellation feature then put data in fields there's nothing happen . plus if anyone have tutorials for use android with parse.com please provide me with it.

How can I query the specific value of an object in my Parse class and set it to a String? Given that I have an object with a specific objectId, I want the value for the "position" column, and I want to set it to a String.

    ParseQuery<ParseObject> query = new ParseQuery<ParseObject>("NativeAd");
    query.whereEqualTo("objectId", "fYBeufqdOt");
    query.findInBackground(new FindCallback() {

        @Override
        public void done(List objects, ParseException e) {
            if (e == null) {
                Log.d("NativeAd", "Retrieved " + objects.size());
                for (ParseObject adPosition : objects) {
                    String n = adPosition.get("position").toString();
                    System.out.println(n);
                }
            } else {
                Log.d("NativeAd", "Error: " + e.getMessage());
            }
        }

    });

Similar Question 4 (1 solutions) : Getting data from object Id in Parse.com

Similar Question 6 (1 solutions) : parse.initialize error for parse.com

Similar Question 7 (2 solutions) : How to Append a column in parse.com database

Similar Question 9 (1 solutions) : How can I put on Parse.com the content of an EditText?

cc