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

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

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);
      }
    }
}

10 Answers

finnly got it right

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

Hi there,

Can you post the link to the challenge or let me know what the error is you are getting (and the question you're having a problem with).

Thanks,

Steve.

Hi Steve

Inside the done() method of the callback, add an if statement to check if the ParseException e is null. If it is not null, log the message "ERROR" using the Log.e() method. Don’t forget to use TAG as the first parameter!

JavaTester.java:99: error: cannot find symbol activity.mSignUpCallback.done(new ParseException()); ^ symbol: variable mSignUpCallback location: variable activity of type SignUpActivity ./SignUpActivity.java:19: error: incompatible types: ParseException cannot be converted to boolean if(e = null) ^ 2 errors

Looking at your error there, in particular this bit: ParseException cannot be converted to boolean if(e = null)

You're trying to assign null to e. Not test if e equals null. Try starting with if (e == null) - the double equals sign checks for equality, a single equals sign tries to assign values to variables.

Make sense?

Steve.

Yes it does make sence but im still getting an error ??

thanks

thomas.

Can you post the code for your done() method?

Steve.

public void done(ParseException e) {

Isn't your 'if' statement in there?

This is my full code

thanks

 public void done(ParseException e)
        {
          if (e == null){
           //success
          }
          else{
            Log.e(TAG , "ERROR");
          }
        } 
      });
    }
}

I can't see anything wrong with that. I can't check all the closing brackets, though.

What error is it giving you?

finnly got it right

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