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

Derrick Shepherd
Derrick Shepherd
4,861 Points

I Keep Getting An error but don't know why...

Here's The Assignment: In the signUp() method, create a new ParseUser variable named newUser and initialize with its constructor. Set the username and password properties using the method parameters and appropriate methods.

Here's The Code With My Answer At The Bottom:

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) {

  //My Answer Below

  ParseUser newUser = new ParseUser();

   newUser.setUserName(username);

  newUser.setPassword(password);

}

}

3 Answers

Derrick Shepherd
Derrick Shepherd
4,861 Points

Thanks for responding Gergo, I figured out the problem after I posted this, I had the "N" capitalized in "setUserName" , it was supposed to be "setUsername".

Gergő Bogdán
Gergő Bogdán
6,664 Points

What is the error message?

For Gergo,

The error message the challenge generates for "N" capitalized in "setUserName" (instead of "setUsername"), is as follows:

/*

./SignUpActivity.java:24: error: cannot find symbol
      newUser.setUserName(username);
             ^
  symbol:   method setUserName(String)
  location: variable newUser of type ParseUser
1 error

*/

I hate the fact that these parser errors rarely place the caret in the right part of the line (underneath the character that is at issue).

Oh..and here is the link to the challenge: http://teamtreehouse.com/library/creating-a-new-user-on-parse

Gergő Bogdán
Gergő Bogdán
6,664 Points

Hi,

The issue is, that the ParseUser class does NOT have a method setUserName, most probably it has setUsername. Notice the small n in Username.