Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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