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

Does getting and setting in an onClickListener break the MVC rule?

So I am trying to make the Fun Facts app added with some other functionalities, I noticed that in the tutorial the getFact() also sets the fact first. I tried using separate method i.e. setFact() getFact() and realize that I will keep getting the same result if I only called getFact(). I found a workaround by calling setFact() first.

I then tried to add more functions and end up with 2 pairs of getters and setters called in the onClickListener.

So back to the title