Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Android Build a Self-Destructing Message Android App Adding Users Using Parse.com Creating a New User on Parse

Mike Benjamin
Mike Benjamin
16,568 Points

Andriod mSignUpCallback

Having problems with challenge 2 of 3 in adding users to parse code challenge...

./SignUpActivity.java:25: reached end of file while parsing
};
  ^
./SignUpActivity.java:24: cannot find symbol
symbol  : constructor SignUpCallback(com.parse.SignUpCallback)
location: class com.parse.SignUpCallback
      newUser.signUpInBackground(new SignUpCallback(mSignUpCallback){});```
                                 ^
And my code is as follows


protected void signUp(String username, String password) {
      ParseUser newUser = new ParseUser();
      newUser.setUsername(username);
      newUser.setPassword(password);
      newUser.signUpInBackground(new SignUpCallback(mSignUpCallback){});
};```



any ideas?

4 Answers

larsfredrik
larsfredrik
2,943 Points

The code should be:

protected void signUp(String username, String password) {
        ParseUser newUser = new ParseUser();
      newUser.setUsername(username);
      newUser.setPassword(password);
      newUser.signUpInBackground(new SignUpCallback() {
      });

Hopes it helped you! ^_^

Another confusing forum thread/answer...

Maybe this would help:

import android.app.Activity;
import android.util.Log;
import com.parse.ParseUser;
import com.parse.ParseException;
import com.parse.SignUpCallback;

public class SignUpActivity extends Activity {

    public static final String TAG = SignUpActivity.class.getSimpleName();

    protected SignUpCallback mSignUpCallback = new SignUpCallback() {
        @Override
        public void done(ParseException e) {

        }
    };

    // onCreate() and other code has been omitted

protected void signUp(String username, String password) {
      ParseUser newUser = new ParseUser();
      newUser.setUsername(username);
      newUser.setPassword(password);
      newUser.signUpInBackground( mSignUpCallback);
 }
}

The challenge was:

Challenge Task 2 of 3

Now let's use the signUpInBackground() method to sign up this new user. For the SignUpCallback parameter, pass in the mSignUpCallback variable initialized in this Activity.

Link: http://teamtreehouse.com/library/creating-a-new-user-on-parse

jenyufu
jenyufu
3,311 Points

thanks this one actually worked!

Maybe because of that semi colon; (mSignUpCallback){}); <------

Mike Benjamin
Mike Benjamin
16,568 Points

even still, I am getting an error on the "new" before new SignUpCallback

Steve Wamsley
Steve Wamsley
7,977 Points

The signup callback is already initialized as a member variable. No need to create a new one. Try this:

newUser.signUpInBackground(mSignUpCallback);