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 Basic Android Programming Generating a Random Number

fact = randomNumber im a little confused

Hi everyone...im a little confused about this line of code: fact = randomNumber

does it mean that we set fact variable to randomNumber variable?

please explain that to me

1 Answer

Hi Yadin,

Yes, that code indicates that we're assigning the fact variable to equal the random number generated by the randomNumber variable. We then concatenate the number with an empty string to coerce the number into a string without explicitly casting it as such, because fact is a String then assigned to a TextView.

Specifically, it's then assigned to mFactTextView to display that number. mFactTextView tells you that you have correctly gone from one random number to another as you click the mShowFactButton.

Hope that helps!

Oh Thank you very much! :)