title | type | duration | creator | ||||
---|---|---|---|---|---|---|---|
Cursor Adapters - Grocery List |
lab |
1:25 |
|
Note: This can be a pair programming activity or done independently.
In this lab, you will be displaying a list of grocery items from a SQLite database using a CursorAdapter
. Each grocery item has a name, description, price, and type. On this screen, you will only be showing the name of each item.
The database is named SHOPPING_DB
The table is named SHOPPING_LIST
- Extend and complete the SQLiteOpenHelper class to query the database for all of the grocery items
- Make a ListView to display the grocery items
- Use a CursorAdapter to display the queried grocery items
Bonus:
- Delete an item from the database when you long-click on the list item (Look here for help)
- Create a custom layout for the ListView item to show more info from the database
The starter-code
folder contains an Android project with the following:
- A MainActivity.java file that prepopulates the database
The screenshot below shows what the app should look like.