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 Build a Simple Android App Improving Our Code Simple Refactoring: Using a New Class

9,780 Points

Is it a common practice to store it in variable and then use it?

In method onClick(): Why do we store the result from getFact() into variable "fact" when 1 row later we just use it as a parameter in setText() ?

Why not just type right away: mFactTextView.setText(mFactbook.getFact());

Is it like a common practice that we should obey?

1 Answer

Ben Deitch
Ben Deitch
Treehouse Teacher

Nope, you're free to write your code however you like! I usually like this way because I think it makes it a little bit easier to read what's going on with the code.