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 Weather App (2015) Networking Making an HTTP GET Request with OkHttp

michaelmugo
michaelmugo
3,971 Points

What exactly the purpose of making the TAG public, when it is recommended as private from the Dev docs?

2 Answers

Ebrima Comma
Ebrima Comma
2,100 Points

Variables or methods declared with access modifier; private are accessible only to the methods of the class in which they are declared. Make the modifier public makes it accessible from outside of the class. So if you want to make that variable to be accessible outside of that class for some reason, then public is your choice. But the most important thing you should note is, the log class is use to output errors in an activity. so you expect it to output errors relating to only that activity not the other way round.

michaelmugo
michaelmugo
3,971 Points

True... And since we're using it for 1 activity so far, then we should just declare TAG privately.

I only see it useful if we declared a custom log class

Ebrima Comma
Ebrima Comma
2,100 Points

You should consider accepting the answer by allocating points