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 (2014) Creating the Screen Layout Adding a Button

What does it mean when you say use id in the system?

android:id="@+id/button" Whats the id in the code for?

2 Answers

Daniel Čupak
Daniel Čupak
6,602 Points

Hi Raj,

it basically means "id of a button is button"

you need to reference your button to use it in the code later - something unique so the java knows that that is the thing you want to use

id should be more specific e.g. "big_Next_button"

Hey raj,

as for button, with the ID you can connect to the button View and use the onClickListener to perform an action with it. name is very importent, espically when you have multiple buttons. for example:

Button sendData= (Button) findViewById(R.id.btnSend); its common to use "btn" as a part of the button ID.