Lecture 6 & HW 6: Networking, Data, and Persistent Storage

Final Feedback Form: [TBD]

Quick Note:

Y'all are awesome! Thank you for all of your hard work so far; we have a small enough class for me to know that each of you (yes, ALL) are very talented and bright Android Developers. I wish you all success and happiness ☺.

Demo Code:

Completed lecture demo code:

Completed "discussion" demo code:

Homework Instructions:


Your goal for this week's assignment is to build a notes app using fragments, data-sharing techniques, and networking. We'll provide some guidelines below, but different implementations can often lend themselves to different UI's so you will have the freedom to design the UI however you'll like!

The API spec for the backend you'll be working with is here: https://github.com/cuappdev/ios-course-messageboard.

The base URL for the backend is:

Note: The backend regularly clears its saved posts. If your call to the endpoint is returning an empty array of posts, it could just be that no one has made a post recently.


  1. Create a CloudNotesActivity with a RecyclerView that displays notes. The notes should be obtained from a GET request to the server in onCreate.

  2. Your app should have a data class to represent a single note based on the backend model. There should also be a singleton class (ie. Repository) that keeps track of the list of notes that have been changed locally.

  3. Each cell in the RecyclerView should display the title, a truncated note body (up to 150 characters), a timestamp, and the username of the poster.

  4. Clicking on any cell in the RecyclerView should open the EditNoteActivity, which in this case will display the note's title and body.

  5. In EditNoteActivity, there should be a way for the user to edit the note title and body. If the user navigated to EditNoteActivity by clicking on a RecyclerView cell, clicking on the save button should save the note to the list in Repository, and the user should be redirected back to CloudNotesActivity. You do not need to save edits to existing notes to the server -- it is sufficient to save them locally (as you'll have to display said local notes as detailed in 7).

  6. CloudNotesActivity should have a "New Note" or "+" button to create a new note. Clicking on it will launch the EditNoteActivity, but in this case, the EditNoteActivity will not be pre-populated, and clicking on the save button should send a POST request to the server to create the note on the server. You can use your net ID for the poster field of the note. The user should be redirected back to CloudNotesActivity after posting.

  7. CloudNotesActivity should also have a button to view local notes. Clicking this button should take you to the LocalNotesActivity, which will use a RecyclerView to display a list of all the notes that you have made edits to locally (list of notes in Repository). There should also be some way of navigating from LocalNotesActivity back to CloudNotesActivity.

Challenge Problems

These are optional challenge problems, and completing each successfully will earn you 1 extra point per problem. If you do attempt a challenge problem, make sure to include a README.txt that states which problem(s) you've attempted!

Cloud Backup

  • Use POST requests to save edits to note bodies on the backend (you do not have to edit note titles)

Swipe to Refresh

  • Refresh your list in CloudNotesActivity when you swipe.

UI Upgrade

  • Use a CardView for the custom layout of the RecyclerView cell for that ✨ clean ✨ and modern look.

  • Add a feature to ListFragment that allows the user to delete a note from the list. You can decide how to design and implement this! Some ideas include swipe to delete, long-press and delete, select to delete.

Search to Filter

  • Add a third fragment to MainActivity. This activity should feature a search bar (ie. SearchView) that allows the user to search for notes by title.

  • Notes that match the search query should be displayed in a list of some sort. This can be either a ListView or RecyclerView.

  • Clicking on a cell in the list should direct the user back to EditNoteFragment where the user can modify the note.

Color Customization

  • Add a feature to EditNoteFragment that allows the user to change the background color of the note. This color should visible in EditNoteFragment and ListFragment.

Here to Stay

  • Use SharedPreferences, to support persistent storage for the list of notes. If the user were to close and reopen the app, the list of notes should persist. This challenge problem is a bit tricky because you'll need to think about how to store and retrieve objects from a SharedPreferences file.


For this assignment, you may need to figure out a few things on your own. Some classes that may be helpful for this assignment include:

For basic functionality:

  • Intent and Manifest

  • RecyclerView

  • EditText

  • Networking

  • Data

For challenge problems:

  • CardView

  • SearchView

  • SharedPreferences

Last updated