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
Eric Conklin
8,350 PointsCannot find symbol Factbook or mFactbook
I'm towards the end of the fun facts application right now. I am getting an error for not being able to find 2 symbols in my Java files:
package com.teamtreehouse.funfacts;
import android.app.Activity;
import android.graphics.Color;
import android.os.Bundle;
import android.view.Menu;
import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.RelativeLayout;
import android.widget.TextView;
import java.util.Random;
public class FunFactsActivity extends Activity {
private FactBook mFactbook = new FactBook();
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_fun_facts);
// Declare our View variables and assign the the Views from the layout file
final TextView factLabel = (TextView) findViewById(R.id.factTextView);
Button showFactButton = (Button) findViewById(R.id.showFactButton);
RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);
View.OnClickListener listener = new View.OnClickListener() {
@Override
public void onClick(View view) {
String fact = mFactBook.getFact();
// Update the label with our dynamic fact
factLabel.setText(fact);
relativeLayout.setBackgroundColor(Color.RED);
}
};
showFactButton.setOnClickListener(listener);
}
}
1 Answer
Eric Conklin
8,350 PointsI found the answer.
Factbook.java was in the wrong folder.
Sorry, Android noob over here!
Taha Abbasi
12,865 PointsHaha, don't sweat it. Figured that was the case. Just a tip, If you do want to work with packages in a different folder. You can do an import statement and then it will work as well.
Taha Abbasi
12,865 PointsTaha Abbasi
12,865 PointsCan yo provide the code form FactBook.java?