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

Android Build an Interactive Story App Intents and Multiple Activities Getting Resources from the Context

[SOLVED]When i try to find to type key_name it says it dont exists.

Hi, When we try assign the key_name i get an error which says it dont exists but i declare this variable in the string.xml file.. : String key = resources.getString(R.string.key_name)

this is the picture of the mainActivity: https://gyazo.com/e85680e54014899b1aa77ec4cac18ee8

strings.xml file: https://gyazo.com/cb87c84dadda3f4a2c4788f549239620

I dont understand why i cant get a refernce of it, when i type R.string if i type dot i get the refernce of app_name...

Lauren Moineau Tonnie Fanadez

SOLVED: I just need to restart android stuido and it worked, its strange.

Hi noob developer. I'm glad you sorted it out. The scary red R is quite common I'm afraid. There are a few solutions (after making sure the problem is not in your resource file):

  • Build > Rebuild Project
  • File > Sync Project with Gradle
  • File > Invalidate Caches / Restart
  • Restart (as you did)

Hope that helps :)