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) Improving Our Code Adding More Colors

Nephi Cosuga
Nephi Cosuga
1,907 Points

Error:(24, 41) error: cannot find symbol class ColorWheel I cant figure out why this wont work as in the video.

trying to make different colors for the funfacts activity but ColorWheel is not working.

public class FunFactsActivity extends AppCompatActivity {

        private FactBook mFactBook = new FactBook();
        private ColorWheel mColorWheel = new ColorWheel();
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_fun_facts);

        //Declare our View variables and assign them the Views from the layout file
        final TextView factlable = (TextView) findViewById(R.id.factTextView);
        Button showFactButton= (Button) findViewById(R.id.showFactButton);
        final RelativeLayout relativeLayout = (RelativeLayout) findViewById(R.id.relativeLayout);
        View.OnClickListener listener = new View.OnClickListener() {
            @Override
            public void onClick(View v) {
               String fact = mFactBook.getFact();
            //Update the label with our dynamic fact
            factlable. setText(fact);

            int color = mColorWheel.getColor();
                relativeLayout.setBackgroundColor(Color.RED);



            }
        };
        showFactButton.setOnClickListener(listener);
Seth Kroger
Seth Kroger
56,413 Points

What's the code for ColorWheel? And what is its source file named?

Kevin Faust
Kevin Faust
15,353 Points

//edited for markup

1 Answer

Michael Riehl
Michael Riehl
725 Points

I had the same issue until I deleted out the last part of the line on the main activity and then re-added it with autocomplete. I am not sure why this worked because it appears to be the same.

private ColorWheel mColorWheel = new ColorWheel();

I began deleting Colorwheel(); and then started typing it again and used the autocomplete. The code compiled and ran properly after that.