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
Why is mCurrentScene set in both onTrackPanelClicked and in the setEnterAction Runnables?
In onTrackPanelClicked(), mCurrentScene is set to the scene that we are transitioning to. Again in the run() method of setEnterAction()'s Runnable, mCurrentScene is set to the scene we are transitioning to. To me it seems like this redundant: by the time run() is called, mCurrentScene is already set to the correct value due to the logic/assignment in onTrackPanelClicked(). Am I missing something? The transition still seems to work as expected with the run() methods' mCurrentScene assignment commented out.
Scott Junner9,010 Points
I've been sitting here scratching my head over this one too. And after commenting out the lines setting mCurrentScene in both calls to setEnterAction it seems you are right.
Setting mCurrentScene in setEnterAction() is redundant. There is no need for it. mCurrentScene is set in onTrackPanelClicked()