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

I'm getting a red error for nameEditText and don't know why! (cannot resolve symbol)

I'm having issues at 2:50 of the video where it says to put: nameField = (EditText)findViewById(R.id.nameEditText);

I am getting red text for nameEditText and it says "cannot resolve symbol 'nameEditText'. I'm not sure how to fix it!

Can you provide a link to the video?

Yeah here's the link https://teamtreehouse.com/library/getting-text-from-an-edittext

I got stuck at the part where it had me put

 nameField = (EditText)findViewById(R.id.nameEditText);

because the nameEditText keeps coming up as an error and says "Cannot resolve symbol 'nameEditText' "

Stackoverflow didn't help.

So doing more of the video I see that the error shows up again. Full errors are

 nameField = (EditText) findViewById(R.id.nameEditText);
  startButton = (Button) findViewById(R.id.startButton);

both 'findViewById' and everything after it in that line is highlighted and says "the R.id.startButton has already been looked up in this method; possible cut & paste error?"

1 Answer

Milos Ribera
Milos Ribera
9,633 Points

Hi Aliyah, from the error message it seems that you already instantiate the EditText and the Button above into your code. If it is not you can try to quit Android Studio and open it again, sometimes happens that it shows you an error but after restarting it goes away.

About your first error, it seems you have used another id for the EditText into the xml file, try to check it! Hope it could help you