This course will be retired on July 14, 2025.
Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
- Accessing Views in Code: Declaring Variables 5:20
- Accessing Views in Code: Assigning Variables 6:24
- Initializing a Button 1 objective
- Making a Button Do Something 4:35
- Adding the OnClick Method 2:36
- Android Programming Basics 5 questions
- Generating a Random Number 4:08
- Choosing a Random Fact 4:52
- Using the Random Class 4 objectives
Well done!
You have completed Build a Simple Android App with Java!

- 2x 2x
- 1.75x 1.75x
- 1.5x 1.5x
- 1.25x 1.25x
- 1.1x 1.1x
- 1x 1x
- 0.75x 0.75x
- 0.5x 0.5x
It's often helpful to group items together into an array. In this video, we'll create an array of facts. Then we'll use our randomNumber to help us pick a random fact!
Facts (for copy/paste):
String[] facts = {
"Ants stretch when they wake up in the morning.",
"Ostriches can run faster than horses.",
"Olympic gold medals are actually made mostly of silver.",
"You are born with 300 bones; by the time you are an adult you will have 206.",
"It takes about 8 minutes for light from the Sun to reach Earth.",
"Some bamboo plants can grow almost a meter in just one day.",
"The state of Florida is bigger than England.",
"Some penguins can leap 2-3 meters out of the water.",
"On average, it takes 66 days to form a new habit.",
"Mammoths still walked the earth when the Great Pyramid was being built." };
Further Reading
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Quantavius Mills
491 Points1 Answer
-
thomas mbuzwa
5,233 Points2 Answers
-
michael lee
5,179 Points2 Answers
-
Ajit Mishra
14,797 PointsWhen i run my Android Project My emulator and app run but not showing the anything in it
Posted by Ajit MishraAjit Mishra
14,797 Points0 Answers
-
Maan Azzam
2,239 PointsI used a txt file in ASSETS to take facts from. But it only gets the first line! HELP
Posted by Maan AzzamMaan Azzam
2,239 Points1 Answer
-
PLUS
Sai Krishna Katkam
Courses Plus Student 1,946 Points2 Answers
-
Riya Prasannan
806 Points2 Answers
View all discussions for this video
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up