Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.

Diego Marrs
8,243 PointsDoes your object *need* parameters?
Evan Anger I'm applying what is taught in these videos into my own app, but when I got to this part:
ArrayList<ListItem> list = new ArrayList<ListItem>();
if (cursor.moveToFirst()) {
do {
ListItem listItem = new ListItem(getIntFromColumnName(cursor, BaseColumns._ID),
getStringFromColumnName(cursor, EasyListSQLiteHelper.LISTS_NAME),
getStringFromColumnName(cursor, EasyListSQLiteHelper.LISTS_CHECKED),
null);
list.add(listItem);
}while(cursor.moveToNext());
}
My 'ListItem' got an error as expected because it doesn't have any parameters. It only has two values: an int and string value (getters and setters for those too). So how would I go about reading my two values this way?
Also, do I need to put ListItem into the angle brackets after 'new'?
1 Answer

Chris Jones
Java Web Development Techdegree Graduate 23,921 PointsHey Diego, could you post your code for the ListItem class? That will help me understand the problem.
Thanks!
Diego Marrs
8,243 PointsDiego Marrs
8,243 PointsChris Jones
Java Web Development Techdegree Graduate 23,921 PointsChris Jones
Java Web Development Techdegree Graduate 23,921 PointsIt looks like the problem is that your ListItem constructor doesn't have any parameters, but you're passing it some in your original code snippet.
It looks like you're trying to create a ListItem object for each record returned in a query. However, not all of the query results (_ID, LISTS_NAME, and LISTS_CHECKED) match the ListItem class fields (mListsList, mListName, and mImportant). LISTS_NAME is probably mListName and LISTS_CHECKED might be mImportant, but it doesn't look like you have a column in your query for mListsList.
Either way, if you're wanting to create a ListItem object from your query results, you're going to need to have a ListItem constructor like this:
Does that help some?
I don't know why some of the text in my answer is underlined - that's unintentional so please disregard it.
Diego Marrs
8,243 PointsDiego Marrs
8,243 PointsThat's better, thank you!
Chris Jones
Java Web Development Techdegree Graduate 23,921 PointsChris Jones
Java Web Development Techdegree Graduate 23,921 PointsNot a problem! Please mark the answer as the Best Answer if it was helpful :)!