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 Android Data Persistence Using SQLite for Structured Data Adding the Annotations Table

2 Answers

Harry James
Harry James
14,780 Points

Hey Rommel!

Thanks for this. I'll inform Evan Anger about this. In the meantime, those reading this post can use the code below to fix the error:

    private static final String CREATE_ANNOTATIONS = "CREATE TABLE " + 
            ANNOTATIONS_TABLE + " (" + BaseColumns._ID +
            " INTEGER PRIMARY KEY AUTOINCREMENT," +
            COLUMN_ANNOTATION_X + " INTEGER, " +
            COLUMN_ANNOTATION_Y + " INTEGER, " +
            COLUMN_ANNOTATION_TITLE + " TEXT, " +
            COLUMN_ANNOTATION_COLOR + " TEXT, " +
            COLUMN_FOREIGN_KEY_MEME + " INTEGER, " +
            "FOREIGN KEY(" + COLUMN_FOREIGN_KEY_MEME +
            ") REFERENCES MEMES(_ID))";
Carl Lippert
Carl Lippert
7,359 Points

Still more errors in code copy section:

Is: "FOREIGN KEY(" + COLUMN_FOREIGN_KEY_MEME + ") +
REFERENCES MEMES(_ID))";

Should be: (fixed misplaced quotes by closing parenthesis and removed a +)

"FOREIGN KEY(" + COLUMN_FOREIGN_KEY_MEME + ") REFERENCES MEMES(_ID))";

It is correct above just not in the Teachers notes.