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.
Claudio Chandia357 Points
Cannot resolve "factTextView".
Hello, I'm trying to code the FunFactApp, and It says it "cannot resolve symbol "factTextView", in the line:
TextView factLabel = (TextView) findViewById(R.id.factTextView)
Can someone help me? I've immported the TextView before, so I guess that's not the problem.
Yes, you need to change something.
You're trying to link to a TextView called
TextView factLabel = (TextView) findViewById(R.id.factTextView);
But your XML has two TextViews - one is called:
android:id="@+id/textView" and the other is
You need to decide which one you want to access with the line of code above and either change the id in that line or change the id of the TextView.
I hope that helps!
Have you definitely called the TextView
factTextView? It looks like Android Studio thinks you haven't done that.
Post the xml file for the activity you are working in.