This lesson walks through the pieces you’ll assemble for the capstone assignment — a simple, fully working Notes app combining everything from this course.

App structure

  • MainActivity — shows the RecyclerView list of notes, plus an “Add Note” button.
  • AddNoteActivity — a form with a title and body EditText, and a Save button.
  • A simple in-memory or SharedPreferences-backed list to hold notes for now (you’ll replace this with a real database in the Proficient course’s Room module).

Passing the new note back

// In AddNoteActivity, after Save is tapped:
val resultIntent = Intent()
resultIntent.putExtra("NOTE_TITLE", titleInput)
resultIntent.putExtra("NOTE_BODY", bodyInput)
setResult(RESULT_OK, resultIntent)
finish()
// In MainActivity, using the modern Activity Result API:
private val addNoteLauncher = registerForActivityResult(
    ActivityResultContracts.StartActivityForResult()
) { result ->
    if (result.resultCode == RESULT_OK) {
        val title = result.data?.getStringExtra("NOTE_TITLE") ?: return@registerForActivityResult
        val body = result.data?.getStringExtra("NOTE_BODY") ?: ""
        notesList.add(Note(title, body))
        adapter.notifyItemInserted(notesList.size - 1)
    }
}

registerForActivityResult is the modern replacement for the older, deprecated startActivityForResult — always prefer it in new code.