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 trialJeff Burn
839 PointsWhy do we setup a member variable called mColorWheel and a public class called ColorWheel?
Shouldn't we be able to reference the public class without adding a member variable?
1 Answer
Dylan Merritt
15,682 PointsCreating the ColorWheel class is a way of putting the color code information apart from the rest of your code. This is considered best practice when programming as it keeps things clean and organized. The variable mColorWheel is a reference to your class, so that your Main Activity knows what you're talking about when you reference the code in ColorWheel. Hope this helps!
Greg Schmidt
5,908 PointsGreg Schmidt
5,908 PointsI believe that doing it we run ColorWheel and return colorAsInt, otherwise you wouldn't have anything to get and assign to color.