Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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! :-)