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

Why do you pass View in startDailyActivity() method?

Ben shows in the video that View object view is passed to startDailyActivity() method. But this View object is not used within the method (or at least I don't see it). Why do you do that?

2 Answers

I know Overriden onClick() needs View as an argument but startDailyActivity() isn't. Does startDailyActivity() needs View object passed because it is actually playing a role of onClick()?

Seth Kroger
Seth Kroger
56,413 Points

startDailyActivity() is essentially an implementation of View.OnClickListener() which takes the View clicked for an argument. startDailyActivity() has to do the same even if there is no information in the View it needs or else there'd be a compiler error.