09. Buttons

There’s nothing difficult about adding buttons really, except it’s a good point to talk about the android:id attribute.

In the previous step you may have noticed we had an attribute in the Instructions textview that gave it an id. This is because later on, I am going to want to change what that textview says and so I need to be able to refer to it. This is the same with our buttons…we are going to need to be able to respond when they’re clicked on and so we need to have an id for them.

When creating an id, it is good practice to include the type of UI element it is as a suffix. You’ll see why we make it a suffix when we start adding Java code to this app.

So with this in mind, we’re going to replace the comment place holder we had that said this…