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 trialbizbis
Courses Plus Student 171 PointsNo quick fix for answer.Label.setText(answer)
On the video it shows the quick fix coming up to make this string final, but I don't have that option. It's producing an error so I can't continue, any ideas?
'''Android //Declare our View variables TextView answerLabel = (TextView) findViewById(id.textView1); Button getAnswerButton = (Button) findViewById(R.id.button1);
getAnswerButton.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
// The button was clicked, so update the answer label with an answer
String answer = "Yes";
answer.Label.setText(answer);
'''
1 Answer
chai
2,777 PointsThis line
answer.Label.setText(answer);
should be
answerLabel.setText(answer);
If don't have show any options you can manual add final keyword to your variable such as
final TextView answerLabel = (TextView) findViewById(id.textView1);