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.

Yoshi Gomez
377 PointsWhy Do We Have To Make The Classes?
I had gotten the error about the factTextView = findViewById(R.id.facttextView);
he said that he added classes and the made a new method and completely confused me. i need help please
1 Answer

Joshua Douce
13,120 PointsHi Yoshi, You should have something like this public class mainActivity extends appCompatActivity{ // this is class for your activity
private TextView factTextView; //private member field for your textView
public void onCreate(){
factTextView = (TextView) findViewById(R.id.factTextView); // you must explicit cast the view to a text view i.e (TextView) this then sets the text view in your class to the textview you have on your layout } }
The class is a blueprint to create an object i.e a car class can create many car objects. A method is an action an instance of the object can perform for example a car can accelerate().