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 trialVidit Shah
6,037 Pointsint to String conversion error .LAst Tast Build an INterface Help
Button loadPuppiesButton = (Button) findViewById(R.id.puppiesButton);
String buttonLabel = R.string.morePuppies;
loadPuppiesButton.setText(getString(R.string.morePuppies));
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="morePuppies">See More Puppies</string>
</resources>
2 Answers
Kristian Terziev
28,449 PointsJudging by your code and the lack of a question, I assume you're stuck on task 2. In order to access the string you created in task 1 you need to call getString:
String buttonLabel = getString(R.string.morePuppies);
A side note - When you use the "Get Help" button while you're on a certain challenge(doesn't include videos), the website is smart enough to post your code. I fixed that for you. Please make sure to look at this post to see how to post your code properly or use the Markdown Cheatsheet that you can access under every comment you write.
Unsubscribed User
5,729 Pointsfinal task is simple as that : change the ---> "LOAD" to just---> buttonLabel
<p>
Button loadPuppiesButton = (Button) findViewById(R.id.puppiesButton);
String buttonLabel = getString(R.string.morePuppies);
loadPuppiesButton.setText(buttonLabel);