This practice will be retired on May 1, 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
Preview
Start a free Courses trial
to watch this video
Use a Button and a TextView to create an app that counts up from zero!
Related Links
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
[MUSIC]
0:00
Hey there, I'm Ben and I'm here to give
you a little more practice with Android.
0:04
After all, practicing what you've learned
is one of the best ways to make it stick.
0:09
In this practice session, we're going
to practice creating a new project and
0:14
making a button respond to clicks.
0:17
If you're trying to implement something
and it's just not working, a good way to
0:19
figure out what's wrong is to try and
implement it in an empty project.
0:23
So what we are going to do for
0:27
this session is create an empty
project and then build accounting app.
0:28
Here is what you need to do.
0:32
First, create a new project, naming it
whatever you'd like, I've picked Counter.
0:34
Then, add a button and
text view to the middle of the layout and
0:39
make the text view start with 0 as
well as give the button a label of +1.
0:44
Also, set the size of the text
in the text view to 24 sp.
0:49
Finally, once you've got your button
in your text view, hook them up so
0:54
that when we tap on the button the text
view increments by one, just like this.
0:58
All right now it's your turn,
also if you get stuck or have any issues
1:04
there's some links to related videos
in the teacher's notes below.
1:08
Good luck.
1:11
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