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)
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 PointsR.string. is not popping out the key_name,.. and if i enter it displays red
private void startStory(String name) { Intent intent = new Intent(this, StoryActivity.class); intent.putExtra(getString(R.string.), name); startActivity(intent); }
9 Answers
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Points<?xml version="1.0" encoding="utf-8"?> <resources>
<string name="app_name">Interactive Story</string>
<string name="hello_world">Hello world!</string>
<string name="action_settings">Settings</string>
<string name="title_activity_story">StoryActivity</string>
<string name="key_name">name</string>
<string name="name_key">name</string>
</resources>
am now using the "name_key" which works for me
![James Simshaw](https://secure.gravatar.com/avatar/f01e346c98a43044a15179643be83cb3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Simshaw
28,738 PointsHello,
Without seeing the full code(which is typically very helpful in finding issues), I can only make a few guesses. First, you haven't completed the id, leaving it at R.string. instead of R.string.string_id. The other possibility that I can think of is that you're using subpackages and need to import your R class(do note that the R class is generated automatically). If R is underlined, please select it, hit Alt + Enter, then select import class. Please let us know if these solved your problem or if you need more assistance. If you do need more assistance, please provide your updated code so that we can see where any more issues could be coming from.
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Pointspublic class MainActivity extends Activity {
private EditText mNameField;
private Button mStartButton;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
mNameField = (EditText) findViewById(R.id.namEditText);
mStartButton = (Button) findViewById(R.id.startButton);
mStartButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
String name = mNameField.getText().toString();
startStory(name);
}
});
}
private void startStory(String name)
{
Intent intent = new Intent(this, StoryActivity.class);
intent.putExtra(getString(R.string.key_name) name);
startActivity(intent);
}
}
this is the full code
![James Simshaw](https://secure.gravatar.com/avatar/f01e346c98a43044a15179643be83cb3?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Simshaw
28,738 PointsDo you have any lines starting with "package" or "import"? Those might help track down what's wrong.
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Pointsimport android.app.Activity; import android.content.Intent; import android.os.Bundle; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.widget.Button; import android.widget.EditText;
here is my import
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Pointsthese are my import files
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Pointspackage com.example.jude.interactivestory;
this also my package
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 PointsAm working on Build interactive Story app
![James Simshaw](https://secure.gravatar.com/avatar/f01e346c98a43044a15179643be83cb3?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Simshaw
28,738 PointsNot looking like there's much wrong so you can always try the old, "Clean and rebuild the project" approach. To do this, go to Build, then select Clean Project. Then select Build, then Make Project. That tends to clear up problems like that with no obvious cause. Sometimes people have to also try File, Invalidate Caches/Restart. Please let us know if this helps. If not, we can try a few other things.
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Pointsno its still not working. i tried adding another string to the string.xml which i named "name_key" it popped out but why this "key_name is not popping out that i dont understand
![James Simshaw](https://secure.gravatar.com/avatar/f01e346c98a43044a15179643be83cb3?s=60&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
James Simshaw
28,738 PointsCould you post your string.xml file?
![Jude Dugbere](https://secure.gravatar.com/avatar/eb100c63ffc451f20a2a584a0eecc396?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Jude Dugbere
1,211 Pointsthanks for your help. alright
James Simshaw
28,738 PointsJames Simshaw
28,738 PointsSorry I wasn't able to help figure this out for you. You might want to mark your answer as being the best answer so that people know this at least has been resolved.