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

jenyufu
jenyufu
3,311 Points

accidentally deleted my User class in Parse now can't sign up

It signed up and worked before. But when ben said delete the class in Parse.com data browser, I didn't see that he meant the testobject class and I deleted the User class. I have created a User class again but I can' sign up. Now whenever I try to sign up from the sign up screen in my Android app, I just get the AlertDialog: "Oops! invalid session token" (which is the Parse exception e). Its not a problem with my code because I had just tested and signed up successfully right before I accidentally deleted the User class in Parse.com data browser. Here is the code to the AlertDialog in case its needed to solve the problem:

newUser.signUpInBackground(new SignUpCallback() {  

    @Override 

    public void done(ParseException e) { 

        if (e == null){ 
            Intent intent = new Intent(SignUpActivity.this, MainActivity.class); 
            intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
            intent.addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK);
            startActivity(intent);
        } 

        else {  
            AlertDialog.Builder builder = new AlertDialog.Builder(SignUpActivity.this);
            builder.setMessage(e.getMessage()); 
            builder.setTitle(R.string.signup_error_title);
            builder.setPositiveButton(android.R.string.ok, null);
            AlertDialog dialog = builder.create();
            dialog.show();
        } 
    }
David Anton
David Anton
Courses Plus Student 30,936 Points

Hi Jenyufu,

Try to Logout from the current "Deleted" user. put this code only once to exit this situation:

ParseUser.logOut();

jenyufu
jenyufu
3,311 Points

where do I put that code?

David Anton
David Anton
Courses Plus Student 30,936 Points

where ever you want. i would prefer to comment the SignUp code and write the logout code before it.

jenyufu
jenyufu
3,311 Points

now I'm logged out but the same thing happens

David Anton
David Anton
Courses Plus Student 30,936 Points

Can I send me a screen shot for your parse.com Core? i want to check if it's okay.

Send me the screen shot to my Mail:

david.antoon@hotmail.com

OR

via Facebook David Antoon

jenyufu
jenyufu
3,311 Points

I managed to "fix it" by deleting creating another emulator and using those. So I guess it was something wrong with the emulator (still haven't figured out what). The parse core looks the same as usual, I don't find anything wrong with the backend, its the emulator thats the problem.