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

Cant seem to get getAnswerButton = (Button) findButtonById(R.id.Button1); question right

Im doing the quiz and im supposed to get this answer correct all it says is Button getAnswerButton; and then a added the rest on, is there anything your seeing that im doing wrong because it keeps on saying im doing somthing wrong on that string and i cant figure out what!!

Stone Preston
Stone Preston
42,016 Points

can you post a link to the challenge/quiz you are stuck on.

2 Answers

Stone Preston
Stone Preston
42,016 Points

ok your initial answer is almost correct:

you had:

Button getAnswerButton = (Button) findButtonById(R.id.Button1);

the problems with the above code is you used the wrong method (there is no findButtonById method). you nee to use findViewById. the ID is also button1, not Button1. capitalization matters.

Button getAnswerButton = (Button) findViewById(R.id.button1);
Stone Preston
Stone Preston
42,016 Points

see my answer below. you made a few small errors.