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 PointsHello can you please help me with this task 2 of 5 in Java
In StringTest.java add a String variable named 'label' before the call to setText(). Use the getString(int id) method to set 'label' to the value you just added in strings.xml. The id will begin with 'R.string'.
String[] phoneNumberLabels = { "-home", "-work", "-mobile" };
Button saveButton = (Button) findViewById(R.id.saveButton);
String label = getString(R.String.saveLabel);
saveButton.setText("SAVE");
2 Answers
Andres Mendoza
3,088 Pointsyou are probably getting a syntax error, you need to double check your code:
String label = getString(R.string.saveLabel);
you were almost there but you had 'R.String' when it should be 'R.string'
Ashley Leggett
420 PointsHaha! You are right I was getting a syntax error. I had a long day yesterday I was doing so well with my learning and then suddenly I was stuck.. Thank you very much!!
Andres Mendoza
3,088 PointsYou're Welcome, can you mark this complete?