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 Logging Out

Why did Ben only use one line of code and not the two lines provided by Parse documentation?

At the Parse documentation regarding Current User there are two lines of code:

You can clear the current user by logging them out:

ParseUser.logOut();
ParseUser currentUser = ParseUser.getCurrentUser(); // this will now be null

Why did Ben only use the first line of code and not the two lines provided by Parse documentation? I remember Ben saying in this video that the cache will be deleted with the first line of code, but why did he not use the second line of code?

Is is not necessary or what? The Parse documentation does not provide more information regarding this topic.

1 Answer

The second line is just there to show you that now, the currentUser is null becouse there is no current user logged in. Its affect nothing :)

OK. Thank you for your reply! I guess the documentation at Parse could be more clear at this point then. They should not include the second line of code as 'code', because it does more harm than good.