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 (2014) Basic Android Programming Accessing Views in Code

TextView and Button are Red Errors

The words TextView and Button are considered Errors, and they are not errors in the Course Video.

@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_fun_facts);

    //Declare our View variables
    TextView factLabel;
    Button showfactbutton;
}

2 Answers

Hello,

You probably have not imported the proper classes yet. Could you try selecting each of the underlined class names and hit Alt+Enter and then select, Import Class. If this doesn't work, you could try doing Build, Clean and/or File, Invalidate Caches/Restart.

Yep! That worked! Thx!

You're welcome. Have fun with Android development.

Max Lepper
Max Lepper
6,098 Points

Wow yeah, that's a super easy fix. Thanks!

Thanks