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 a Simple Android App (retired 2014) Getting Started with Android Accessing Views in Code

Intellesense didn't give me TextView1 highlighted in blue after I entered "TextView answerLabel = findViewById(R.id.)

I've organized both imports TextView answerLabel; Button getAnswerButton;

And then wrote "TextView answerLabel = findViewById(R.id.

After the dot I haven't been given the "TextView1" option via intellesense. What do I do? What is happening? My Activity Main said "TextView1 is there in the outline window?

1 Answer

Harry James
Harry James
14,780 Points

I had this problem as well. It's quite a hassle to fix at times.

Here's some steps to check everything:

  1. Check your activity_main.xml file (Located in res >> layout) and make sure your TextView id looks like this:
            ... other code ...
  1. Test, see if the problem is fixed. If not, continue:
  2. Run a project clean. Click Project on the top bar and then click the Clean button. Select CrystalBall or all projects.
  3. Test, see if the problem is fixed. If not, continue:
  4. Make sure that your MainActivity.java file (Located in your package) has a line of code like this:
mAnswerLabel = (TextView) findViewById(R.id.textView1);
  1. Test, see if the problem is fixed. If not, continue.
  2. If you get this far, I'm not sure what it could be. Perhaps export your project (Right click on project then click Export) and upload it to a cloud service for me or somebody else to look at.

P.S: Also try writing in textView1 even if IntelliSense doesn't show it. If it doesn't show an error underneath the text, it must've worked!

Also, it seems Markdown didn't like me putting the steps with a space between them. It just resets the numbers...