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 Exploring the Master-Detail Template Adding More Test Data

Error in build blog reader code challenge

In the "Build a Blog Reader" --> "Exploring the Master Detail" --> "Adding more test data" final coding challenge, there seems to be an error. I'm inputting the code correctly (Im pretty positive), however get a compiler error

my code is

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class DummyContent {

    public static List<DummyItem> ITEMS = new ArrayList<DummyItem>();
    public static Map<String, DummyItem> ITEM_MAP = new HashMap<String, DummyItem>();

    static {
        // Add 3 sample items.
        addItem(new DummyItem("1", "The Avengers", "Whedon"));
        addItem(new DummyItem("2", "The Hobbit", "Jackson"));
        addItem(new DummyItem("3", "Ball of Fire", "Hawks"));
    }

    private static void addItem(DummyItem item) {
        ITEMS.add(item);
        ITEM_MAP.put(item.id, item);
    }

    /**
     * A dummy item representing a piece of content.
     */
    public static class DummyItem {
        public String id;
        public String content;
        public String director;

        public DummyItem(String id, String content) {
            this.id = id;
            this.content = content;
            this.director = director;
        }
    }
}

and the compiler error is

JavaTester.java:29: cannot find symbol
symbol  : constructor DummyItem(java.lang.String,java.lang.String,java.lang.String)
location: class DummyContent.DummyItem
      DummyContent.DummyItem item = new DummyContent.DummyItem("A", "Movie", "Director");
                                    ^
./DummyContent.java:13: cannot find symbol
symbol  : constructor DummyItem(java.lang.String,java.lang.String,java.lang.String)
location: class DummyContent.DummyItem
        addItem(new DummyItem("1", "The Avengers", "Whedon"));
                ^
./DummyContent.java:14: cannot find symbol
symbol  : constructor DummyItem(java.lang.String,java.lang.String,java.lang.String)
location: class DummyContent.DummyItem
        addItem(new DummyItem("2", "The Hobbit", "Jackson"));
                ^
./DummyContent.java:15: cannot find symbol
symbol  : constructor DummyItem(java.lang.String,java.lang.String,java.lang.String)
location: class DummyContent.DummyItem
        addItem(new DummyItem("3", "Ball of Fire", "Hawks"));
                ^
4 errors

2 Answers

I think you forgot to pass the third parameter (String director) to the DummyItem constructor ;)

public DummyItem(String id, String content, String director) {
            this.id = id;
            this.content = content;
            this.director = director;
}

hahaha, gdi, I was so positive I had it right too!

thanks very much!! :)

You're welcome ;)