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 trialmichaelmugo
3,971 PointsWhat exactly the purpose of making the TAG public, when it is recommended as private from the Dev docs?
- Android Log
- The link to the docs: https://developer.android.com/reference/android/util/Log.html
2 Answers
Ebrima Comma
2,100 PointsVariables 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.
Ebrima Comma
2,100 PointsYou should consider accepting the answer by allocating points
michaelmugo
3,971 Pointsmichaelmugo
3,971 PointsTrue... 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