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 Testing in Android Unit Testing Presenting the View

Javier Mera
Javier Mera
16,472 Points

Design question

So in terms of design, would it be appropriate to have a method as part of the View interface, that takes a View object as a parameter? I'm thinking of a situation where one could have multiple Buttons and wanted to do the same thing for all of them, and call that View method for each one of the buttons.

1 Answer

Presenter should know nothing about view so it can be replaced with some other framework, therefore you can't pass view, because it's Android specfic. You should probably have a method for each button and just call private method with proper parameters

Javier Mera
Javier Mera
16,472 Points

Yep that's what I ended up doing. Thanks for the reply