Genís
Genís

Reputation: 1508

Instiantate ParseUser object

According to the Android API documentation in parse.com, the code below should sign up a new user. However, I get the following exception when I try to instiantate a new ParseUser: java.lang.IllegalArgumentException: You must register this ParseObject subclass before instantiating it. The code is the one that follows:

private void createUser() {
    ParseUser user = new ParseUser();
    user.setUsername(mFirstName + " " + mLastName);
    user.setPassword(mPassword);
    user.setEmail(mEmail);
    user.signUpInBackground(new SignUpCallback() {
        public void done(ParseException e) {
            if (e == null) {
                // whatever
            } else {
                // whatever
            }
        }
    });
}

What am I doing wrong?

Upvotes: 0

Views: 1919

Answers (2)

Ivan Bajalovic
Ivan Bajalovic

Reputation: 820

For future reference, to solve this error, add

Parse.initialize(this, applicationId, clientKey);

to your onCreate method.

Upvotes: 2

Genís
Genís

Reputation: 1508

I was simply not initializing the library. Fixed!

Upvotes: 2

Related Questions