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 Retrieving and Viewing Messages Retrieving Messages

Masum Bergmann
PLUS
Masum Bergmann
Courses Plus Student 4,129 Points

ParseUser.getCurrentUser() substitute

Hi all... just a quick question to make sure I'm not missing anything obvious.

When using ParseQuery to get all the messages from one user id, we use (in the video):

ParseUser.getCurrentUser().getObjectId()

Wouldn't mCurrentUser.getObjectId() do the same thing, since mCurrentUser is initialized in the onCreate() method with ParseUser.getCurrentUser()? Or is there a specific reason why we shouldn't do that?

I'm thinking, since we have this member Variable, we might as well use it, right? ;-)

Cheers,

Masum

EDIT: LOL!! Nevermind! Just got to the part of the video where Ben realizes that we're adding the code to the wrong file (I'm glad these things don't just happen to me!). Obviously since there is no mCurrentUser in the InboxFragment, (which is where the code belongs) my Question has been rendered moot! But thanks for reading!! ;-)

1 Answer

Ben Jakuben
STAFF
Ben Jakuben
Treehouse Teacher

Sorry for the confusion! We intentionally leave some mistakes in to show how it happens to everyone and how to overcome them.

Masum Bergmann
Masum Bergmann
Courses Plus Student 4,129 Points

No worries! I also think it's a good idea to leave the mistakes in, because of the same reasons you mentioned! :-)