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!

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) Basic Android Programming Initializing a Button

not sure what to do on stage 3 challenge task 1

Not sure what to do here: Challenge task 1 of 1 Initialize the showFactButton variable using the findViewById() method like the TextView above it. The ID for the button is showFactButton, and don't forget to cast it to a Button with (Button)!

i go to where it says Button showfactbutton; and i put Button showfactbutton = (button) findviewbyid(r.id.showfactbutton);

3 Answers

Stone Preston
Stone Preston
42,016 Points

java is case sensitive (as are most languages). you did not capitalize what needed to be captialized.

you had

Button showfactbutton = (button) findviewbyid(r.id.showfactbutton);

you need

Button showFactButton = (Button) findViewById(R.id.showFactButton);

notice that you need to use camel case. whenever you have multiple words in a variable or method name, you start with a lowercase letter, then each word after that begins with an uppercase letter.

That worked thank you

I am struggling to complete this question. The error message tells me I have a compiler error. I have made sure that everything is written in camel case; however, I can't figure out where I made a wrong turn! Help would be appreciated. Thanks!

me too it now confusing