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 trialAshley Leggett
420 PointsCan someone please help me with this Challenge task 3 of 5. Its very simple but for some reason I just can't work it out
Set the text of the Button using the 'label' variable instead of the hard-coded text currently there.
String[] phoneNumberLabels = { "-home", "-work", "-mobile" };
Button saveButton = (Button) findViewById(R.id.saveButton);
String label = getString(R.string.saveLabel);
saveButton.setText("SAVE");
1 Answer
y0mki
14,218 PointsHi Ashley,
all you have to do here is to replace the hard-coded String "SAVE" with the label String that you have declared. So your code should look something like this:
String[] phoneNumberLabels = { "-home", "-work", "-mobile" };
Button saveButton = (Button) findViewById(R.id.saveButton);
String label = getString(R.string.saveLabel);
saveButton.setText(label); // Here comes the label :)