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
MUZ140772 Thomas Mushayi
4,418 PointsNow 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
MUZ140772 Thomas Mushayi
4,418 Pointsfinnly got it right
protected void signUp(String username, String password) { ParseUser newUser=new ParseUser(); newUser.setUsername(username); newUser.setPassword(password); newUser.signUpInBackground(mSignUpCallback);{ } } }
Steve Hunter
57,712 PointsHi 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.
MUZ140772 Thomas Mushayi
4,418 PointsHi 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!
MUZ140772 Thomas Mushayi
4,418 PointsJavaTester.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
MUZ140772 Thomas Mushayi
4,418 PointsSteve Hunter
57,712 PointsLooking 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.
MUZ140772 Thomas Mushayi
4,418 PointsYes it does make sence but im still getting an error ??
thanks
thomas.
Steve Hunter
57,712 PointsCan you post the code for your done() method?
Steve.
MUZ140772 Thomas Mushayi
4,418 Pointspublic void done(ParseException e) {
Steve Hunter
57,712 PointsIsn't your 'if' statement in there?
MUZ140772 Thomas Mushayi
4,418 PointsThis is my full code
thanks
public void done(ParseException e)
{
if (e == null){
//success
}
else{
Log.e(TAG , "ERROR");
}
}
});
}
}
Steve Hunter
57,712 PointsI can't see anything wrong with that. I can't check all the closing brackets, though.
What error is it giving you?
MUZ140772 Thomas Mushayi
4,418 Pointsfinnly got it right
protected void signUp(String username, String password) { ParseUser newUser=new ParseUser(); newUser.setUsername(username); newUser.setPassword(password); newUser.signUpInBackground(mSignUpCallback);{ } } }