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
James Brittain
1,675 PointsWhat am I doing wrong?
So I'm working on the Initialize get answer button code challenge on the Android App development course, and I can't figure out what I did wrong.
TextView answerLabel = (TextView) findViewById(R.id.textView1);
Button getAnswerButton = (Button) findButtonById(R.id.button1);
5 Answers
Kobus Pitzer
1,025 PointsBoth should be findViewById if I remember correctly.
James Brittain
1,675 PointsYou rock SO hard
Constantine Antonakos
9,741 PointsYes, remember that a 'button' is still a UI view component.
James Brittain
1,675 PointsYeah it at first glance seems counter intuitive from having done a bit of HTML but then I guess a UI view is anything you want to display
James Brittain
1,675 PointsOkay working on the Learning the Language Code Challenge, I got the first three right and I can't figure out what I'm doing wrong
Random randomGenerator= new Random();
int randomNumber = randomGenerator.nextInt(10);
answer = Integer.toString(randomNumber);
Charlie Thomas
40,856 PointsYou haven't declared the type for answer. It should be: String intAsString = Integer.toString(randomNumber);
Amy Wissell
2,310 PointsThanks Charlie! I was looking for this answer!