简体   繁体   中英

ParseObject() has protected access

Still trying to figure out this Parse thing. I'm getting error that says that Parse is protected. I have tried putting it in its own class extending Object but then I got a lot more errors. Any advice will help.

        mSignUp.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            String firstName = mFirstName.getText().toString().trim();
            String lastName = mLastName.getText().toString().trim();
            String email = mEmail.getText().toString().trim();
            String phone = mPhone.getText().toString().trim();
            String password = mPassword.getText().toString().trim();
            ParseObject dataObject = new ParseObject();
            dataObject.put("Name", firstName);
            dataObject.put("Last name", lastName);
            dataObject.put("Email", email);
            dataObject.put("Password", password);
            dataObject.put("Phone", phone);
            dataObject.saveInBackground();

This is a parse user, why don't you use ParseUser? You are using ParseObject, but you don't define class name :

ParseObject dataObject = new ParseObject("ClassName???");

Try to use below code

ParseUser user = new ParseUser();
user.setUsername("my name");
user.setPassword("my pass");
user.setEmail("email@example.com");

// other fields can be set just like with ParseObject
user.put("phone", "650-253-0000");

user.signUpInBackground(new SignUpCallback() {
  public void done(ParseException e) {
    if (e == null) {
      // Hooray! Let them use the app now.
    } else {
      // Sign up didn't succeed. Look at the ParseException
      // to figure out what went wrong
    }
  }

});

You can read more about ParseUser here : https://parse.com/docs/android/guide#users

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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