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 trialMike Benjamin
16,568 PointsAndriod 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
2,943 PointsThe 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! ^_^
james white
78,399 PointsAnother 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
3,311 Pointsthanks this one actually worked!
Nick Kouzas
10,619 PointsMaybe because of that semi colon; (mSignUpCallback){}); <------
Mike Benjamin
16,568 Pointseven still, I am getting an error on the "new" before new SignUpCallback
Steve Wamsley
7,977 PointsThe signup callback is already initialized as a member variable. No need to create a new one. Try this:
newUser.signUpInBackground(mSignUpCallback);
Mike Benjamin
16,568 PointsMike Benjamin
16,568 Pointsyessss thanks lars!