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 trialEkaterina Zudina
676 Points"Bummer! Don't forget to call getString() to get the string value from strings.xml"
Hello! I got "Bummer! Don't forget to call getString() to get the string value from strings.xml" message but I can't find errors in the code: Resources resources = getResources(); String buttonLabel = resources.getString(R.string.morePuppies); Could you help me to find out what's wrong? Thanks in advance!
Button loadPuppiesButton = (Button) findViewById(R.id.puppiesButton);
Resources resources = getResources();
String buttonLabel = resources.getString(R.string.morePuppies);
loadPuppiesButton.setText("LOAD");
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="morePuppies">See More Puppies</string>
</resources>
1 Answer
Ekaterina Zudina
676 PointsI solved this problem: Button loadPuppiesButton = (Button) findViewById(R.id.puppiesButton); String buttonLabel = getString(R.string.morePuppies); loadPuppiesButton.setText("LOAD");
But I didn't understand why I couldn't use Resources method.