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
The OnClick method is called when the button is actually clicked (or tapped). Any code in the OnClick method will run each time we tap the button!
Documentation
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up-
Parsa Khodabakhshi
1,024 Points0 Answers
-
Sevak Ohanian
930 Points1 Answer
-
Alan Kuo
7,697 Points2 Answers
-
George Brandt
Python Development Techdegree Graduate 9,649 Points17 Answers
-
Linda de Haan
12,413 Points1 Answer
-
rosemary joe
8,416 Points0 Answers
-
Kyle King
2,973 Points0 Answers
-
Binyamin Friedman
14,615 Points1 Answer
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