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 Blog Reader Android App Rebuilding from Scratch Adding Data for the List

This challenge seems to be broken, gives always an error

This is the error I get, even if I don't modify any code:

JavaTester.java:44: error: cannot find symbol
if (activity.mSongTitles.length < 3) {
            ^
  symbol:   variable mSongTitles
  location: variable activity of type MainListActivity
1 error

4 Answers

Try removing activity from... "activity.mSongTitles.length" instead use "mSongTitles.length"

Hi.

I can't remove that as the code that have the error is the one that, I believe, checks for challenge completion. This is the initial code I get:

package com.example;

import android.app.ListActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ArrayAdapter;

public class MainListActivity extends ListActivity {

    @Override
    public void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_main_list);
    }
}

This is the error:

JavaTester.java:44: error: cannot find symbol
if (activity.mSongTitles.length < 3) {
            ^
  symbol:   variable mSongTitles
  location: variable activity of type MainListActivity
1 error

Okay, you get that error because you are yet to do what it asks you to do which is... "Declare an array of Strings as a member variable of the MainListActivity class. Name it 'mSongTitles', make it 'public', and initialize it with at least three values." Once you do that correctly there won't be an error. If you try to submit the code without doing what it asks for it will give you an error.

Yes, it works when I complete this part of the challenge. But, on all others challenges if you check work before actually doing something the error looks something like this:

"Bummer! Don't forget to..."

Instead of a compiler error (that doesn't even indicate a problem with my code).

Thanks.

Oh, yeah usually... "Don't forget to..." notes a possible error you have done. All errors don't appear in the "compiler" thing all the time.