Welcome to the Treehouse Community

The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

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:
        <TextView
            android:id="@+id/textView1"
            ... 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...