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 trial![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![MUZ140118 Cathrine Makuya](https://uploads.teamtreehouse.com/production/profile-photos/2175882/micro___263_78_272_7142__20141125_234759.jpg)
MUZ140118 Cathrine Makuya
10,300 Pointsstage 2 challenge 2
Now switch back to CodeChallenge.java. Set the buttonLabel variable to the new String resource you just added using the getString(int id) method. Don't forget: the id parameter will begin with R.string.
Button loadPuppiesButton = (Button) findViewById(R.id.puppiesButton);
String buttonLabel = "";
loadPuppiesButton.setText("LOAD");
intent.putExtra(getString(R.string.morePuppies),buttonLabel);
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="morePuppies">See More Puppies</string>
</resources>
4 Answers
![Gloria Dwomoh](https://uploads.teamtreehouse.com/production/profile-photos/1669872/micro_287e5c5fa5fa84a62083d156a02582e2.jpg)
Gloria Dwomoh
13,116 PointsThe question says "Set the buttonLabel variable to the new String resource you just added using the getString(int id) method. "
In other words...get the string resource and assign it to the buttonLabel using the getString method is given as a hint. You were very close but it wants something simpler. Something like this should work.
Button loadPuppiesButton = (Button) findViewById(R.id.puppiesButton);
String buttonLabel = getString(R.string.morePuppies);
loadPuppiesButton.setText("LOAD");
![William Juste](https://secure.gravatar.com/avatar/7ecfbdbc68f94237637a0ca4f3a254e5?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
William Juste
7,822 PointsCan someone please explain to me why the "S" in the (R.string.stringname); isn't capitalized? I thought all Object names needed to be capped. Just curious as this is the reason why I got this wrong.
![dimas aaron](https://uploads.teamtreehouse.com/production/profile-photos/4311322/micro_profile_pic_DAS.jpg)
dimas aaron
6,660 PointsHi William, maybe this: it is only an XML naming for reference, but Java use capital as required, a class.
![Nejc Vukovic](https://uploads.teamtreehouse.com/production/profile-photos/2012982/micro_benti_nejc.jpg)
Nejc Vukovic
Full Stack JavaScript Techdegree Graduate 51,574 Pointsintent.putExtra (this, getString(R.string.label), buttonLabel);
this could work... not sure on this one...
Getting heavier -> didn't start with Android Dev yet.
![MUZ140118 Cathrine Makuya](https://uploads.teamtreehouse.com/production/profile-photos/2175882/micro___263_78_272_7142__20141125_234759.jpg)
MUZ140118 Cathrine Makuya
10,300 Pointsthanks
![shiva csk](https://secure.gravatar.com/avatar/88ae531422425e8931c3776040facd4c?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
shiva csk
646 Pointswhat is hard-coded string??
![Gonzalo Nunez](https://secure.gravatar.com/avatar/d4e06d4f8cd7e9a314dc6c16d2915697?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gonzalo Nunez
Courses Plus Student 5,064 Pointshard-coded is when you put a specific value to the parameter. Ex = String name =( " Shiva"); ( This is hard-coded to your name).
MUZ140118 Cathrine Makuya
10,300 PointsMUZ140118 Cathrine Makuya
10,300 Pointsthanks Gloria.l will do as you have said
Gloria Dwomoh
13,116 PointsGloria Dwomoh
13,116 PointsYou are welcome. It will help you improve a lot.
MUZ140118 Cathrine Makuya
10,300 PointsMUZ140118 Cathrine Makuya
10,300 PointsGloria l am sorry to bother you but l have tried my best on the third challenge but its not even working can you please help for the last time please
MUZ140118 Cathrine Makuya
10,300 PointsMUZ140118 Cathrine Makuya
10,300 Pointshere is the challenge Finally, use the buttonLabel variable to set the text for loadPuppiesButton instead of the current hard-coded String.
Gloria Dwomoh
13,116 PointsGloria Dwomoh
13,116 PointsThat's quite simple. All it wants you to do is use your buttonLabel variable instead of the hard-coded "LOAD" string. In this way
MUZ140118 Cathrine Makuya
10,300 PointsMUZ140118 Cathrine Makuya
10,300 Pointsthanks Gloria ....l see where l go wrong ...l did not remove the " " thanks